11-25-2008 05:46 AM
I have spent a considerable amount of time this morning trying to get the 'Get Date/Time String' function to work correctly. Regardless of the 'date format' and 'want seconds' settings I can only get a string of the form yyyy-MM-dd and HH:mm!
I have just discovered that the function is dependent on the settings within 'Regional and Language Options' within the Windows XP control panel. (See attached screen dumps of examples).
It therefore appears to be a dangerous function as there is no way of knowing what the control panel settings of a particular machine will be.
Why is this limitation / dependence is not documented in the help files?
11-25-2008 06:00 AM - edited 11-25-2008 06:02 AM
There are several functions that you can use to convert a time stamp to a string. The one you used can be thought of as specifically designed to do what you have observed. You can allow the user to select the date and time presentation without needing to query the OS settings from your application.
There is an additional function in the Time & Dialog palette called Format Date/Time String. This function allows you to specify the formatting parameters of the string regardless of the OS settings. I've attached an example (LV 7.0 format) ...
11-25-2008 08:15 AM
Many thanks for your reply Philip.
I was aware of this solution, but my concern was that the behaviour of the 'get date/ time' function is not properly documented and seems to suggest that the vi can modifiy the displayed date and time format. From my tests it clearly cannot, and relies completely on the OS settings.
i.e. if the OS time setting is HH:mm:ss.tt (i.e 10:20:25 AM) then the function will return '10:20:25 AM' if the OS time setting is HH:mm (i.e 10:20) then the function will return '10:20' regardless of the 'Want Seconds' setting.
Is this expected behaviour?
The only mention of the OS settings in the help file(s) is regarding the time zone.
11-25-2008 08:48 AM - edited 11-25-2008 08:48 AM
Documented like this?
What version of LabVIEW do you have? The above information is from version 8.5 and the help for 7.1 shows the same thing.
11-25-2008 09:55 AM
8.5.
11-26-2008 09:00 AM
11-27-2008 02:14 AM
Thanks for pointing out the relevant help sections.