Showing results for 
Search instead for 
Did you mean: 

string to timestamp conversion

Hey folks,

I feel like I'm having a mental block on this one...

I need to convert a string week (1-53) and a string year (20[0-9][0-9]) into the month that the week starts in that year. Typing directly into the timestamp control, LabVIEW 7.1 does this admirably. What LV doesn't seem capable of is programmatically converting a string into a timestamp.

The article at:
called "How Can I Programmatically Update a Timestamp Control in LabVIEW?" suggest conversion into a date/time cluster followed by arithmetic. Of course, the date/time cluster doesn't have a "week of the year" entry, so I can't go that way.

Am I stuck tinkering with the left-over offset of seconds from the 53rd week of the last year?


Joe Z.
0 Kudos
Message 1 of 7
Hmm, try taking the string (some parsing will be needed) and convert everything to seconds. Then, when you have the seconds, send it to the number to time stamp vi located [numeric|conversion]. Might be an easier way but this is what I would do... beuller?
0 Kudos
Message 2 of 7
Since you are doing weeks, I'm thinking that my julian date utilities may be what you need to convert week to day number and then back to month and day. If you don't come up with a more clever solution, I'll be glad to toss you my date vi's.

Technical geek, engineer, research scientist, biodegradable...
0 Kudos
Message 3 of 7
Thanks for the replies Chaos and Sheldon,

I ended up calculating... well, I'll just show you in attachment. It doesn't really address boundary conditions that might pop up, but it works for the level that I need. If you spot any bad logic in this, yell!

Thanks folks,

Joe Z.
Message 4 of 7
could you please email me your julian date vi's?

much appreciated.


0 Kudos
Message 5 of 7
There are several "Julian Date" VIs available as example programs in the NI Developer Zone.
I am not sure if any of these are exactly the ones that Sheldon Stokes suggested, but they should perform the same function for you.

If you take a look at this search you can see the example programs that are available for download.

Scott Y
0 Kudos
Message 6 of 7
Well, since this has become active again...

I found a bug in my attached picture. The year needs to be decremented when the input week is zero.

There, I feel better now 🙂
Message 7 of 7