LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Elapsed Time VI Present Time String to Elements

Hi All,

 

I want to get the string "7/28/2011 3:31:18 PM" as is from the Elapsed Time VI Present Time Setting into an Array that I'm using as a write-out file.  I tried using the "Scan From String" function but I can't seem to get the right Format String.  I found the "Syntax elements" but they seem to use different combos then the example given for time in the "Scan From String" function help box.

 

Thank you for your help,

Falcon9a

0 Kudos
Message 1 of 14
(3,111 Views)

Hi Falcon,

 

that should give you a kick:

check.png

Btw.: that doesn't seem to recognize the AM/PM flag - at least on my German WinXP. So someone else may shed some light on this. But: Who uses 12hour time format string for scientific data?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 14
(3,108 Views)

@GerdW wrote:

Hi Falcon,

 

 

Btw.: that doesn't seem to recognize the AM/PM flag - at least on my German WinXP. So someone else may shed some light on this. But: Who uses 12hour time format string for scientific data?


Try thisSmiley Wink

1.png

 

the Indicator is set for system time format- and those darn AM PM flags a system dependant-  better to just let the system setting work for us rather than fight them.


"Should be" isn't "Is" -Jay
Message 3 of 14
(3,103 Views)

Hi Jeff,

 

"better to just let the system setting work for us"

 

Well, this will only work in the US...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 14
(3,091 Views)

A drill through the format strings help will eventually get to the table of the time strings. In a footnote, it says,,,

 

  • You cannot use <%H> (24-hour clock) and <%p> (AM/PM flag) together in the same time format string. If you use <%I> (12-hour clock) instead of <%H>, <%p> operates properly

 

So,,   Use %I (In phonetic alphabet that's upper case India) instead of %H

 

One route to the help page is via the Help Contents

VI and function reference --> String Functions --> Format Codes for the Time Format String

 

Rod

 

Message 5 of 14
(3,080 Views)

@GerdW wrote:

Hi Jeff,

 

"better to just let the system setting work for us"

 

Well, this will only work in the US...


Not quite Smiley Wink the Elapsed Time vi. (if you care to drill through the vi) returns "Present Text" as string from a Format date/ time primative with the default (%c) format.  %c is equall to %<%x %X>T universally! Even in Germany!

 

Format.png

 

Note: I forgot about %c...  but who likes to write "c" in  LabVIEW anyway?Smiley Very HappySmiley Very HappySmiley Very Happy


"Should be" isn't "Is" -Jay
Message 6 of 14
(3,071 Views)

Cool, that seem perfect, but now how do I turn the red line into an orange one?

 

Thank you,

Falcon9a

0 Kudos
Message 7 of 14
(3,061 Views)

@Jeff Bohrer wrote:

Not quite Smiley Wink the Elapsed Time vi. (if you care to drill through the vi) returns "Present Text" as string from a Format date/ time primative with the default (%c) format.  %c is equall to %<%x %X>T universally! Even in Germany!


Perhaps. But (at least in LV2009) %x %X and %c LOCALE-SPECIFIC.

 

Thus on my system, 29/7/2011 02:03:04 AM and 29/7/2011 02:03:04 PM (using %c format) both refer to the early morning today 29/07/2011. The AM or PM is not scanned/ignored as the format has been satisfied after the "04"

 

Rod (in the UK)

 

EDIT: Using format date/time string, with format "%c" is is now a little after 29/07/2011 14:39:32

 

 

0 Kudos
Message 8 of 14
(3,060 Views)

@Rod wrote:

@Jeff Bohrer wrote:

Not quite Smiley Wink the Elapsed Time vi. (if you care to drill through the vi) returns "Present Text" as string from a Format date/ time primative with the default (%c) format.  %c is equall to %<%x %X>T universally! Even in Germany!


Perhaps. But (at least in LV2009) %x %X and %c LOCALE-SPECIFIC.

 

Thus on my system, 29/7/2011 02:03:04 AM and 29/7/2011 02:03:04 PM (using %c format) both refer to the early morning today 29/07/2011. The AM or PM is not scanned/ignored as the format has been satisfied after the "04"

 

Rod (in the UK)

 

EDIT: Using format date/time string, with format "%c" is is now a little after 29/07/2011 14:39:32

 

 


did you start with the output from "present text" out of Elapsed Time vi on your pc or the litteral text from the OP? What are your local specific settings (24 hr clock maybe?  "14:39:32")


"Should be" isn't "Is" -Jay
0 Kudos
Message 9 of 14
(3,053 Views)

Jeff Bohrer wrote:

 


did you start with the output from "present text" out of Elapsed Time vi on your pc or the litteral text from the OP? What are your local specific settings (24 hr clock maybe?  "14:39:32")



I've just tried again.

New VI. Drop an elapsed time.vi.

Right click on the present text output. Create indicator

Run the Vi.

 

I get 29/07/2011 14:56:00

 

I have my locale set to English (United Kingdom)

Thus the standard settings of dd/mm/yyyy HH:MM:SS (24 hour clock) are in effect.

 

 

Rod

 

0 Kudos
Message 10 of 14
(3,037 Views)