12-30-2005 08:28 PM
12-31-2005 05:30 AM
The "tricky" part is to convert from AM/PM to 24 hour clock
- between 12:00 AM and 12:59 AM, subtract 12 hours : 12:59 AM --> 00:59
- between 1:00 AM and 12:59 PM, straight conversion : 10:00 AM --> 10:00
- between 1:00 PM and 11:59 PM, add 12 hours : 10:59 PM --> 22:59
The attached vi does the job.
12-31-2005 08:00 AM
12-31-2005 01:28 PM
12-31-2005 01:46 PM - edited 12-31-2005 01:46 PM
Now we even retain the milliseconds!
Message Edited by altenbach on 12-31-2005 11:49 AM
12-31-2005 03:00 PM
One problem with this is the timestamp is set by default to specific settings (system date and time). Unless those are identical to your string format, you will be in a problem.
Attached is a VI I wrote once, which I think should be a basic part of the Time and String palettes (or whatever they're called in 😎 - it accepts a format string and converts it to a timestamp. It may not be complete, but it shows the concept. With some modification, it could probably accept AM\PM too.
BTW, Altenbach, I think your method is basically cool. Perhaps using the Format String property would help there.
12-31-2005 07:45 PM
@tst wrote:
One problem with this is the timestamp is set by default to specific settings (system date and time). Unless those are identical to your string format, you will be in a problem.
01-01-2006 11:40 AM
01-01-2006 01:47 PM
Yes, they are not allowed so there is no problem. 🙂
@chilly charly wrote:
Christian, I am puzzled by the comments attached in your vi, about the valid AM/PM format : I thought that times beginning with 00 were not allowed in the 12 h clock system.Could you develop further ?
01-01-2006 02:10 PM - edited 01-01-2006 02:10 PM
Message Edited by altenbach on 01-01-2006 12:10 PM