LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

day of the year out of a specific timestamp

Solved!
Go to solution
Highlighted

Hello,

I want to calculate the day of the year out of a given date. NOT out of the current timestamp which is given by the vi "seconds to date/time" in combination with "day/time to seconds". I do not find the way to  change the content of a timestamp like "bundle by Name" of a Cluster.

 

Sounds simple, but i don't want to go the way to calculate the day manually concerning leap years.

Thanks in advance,

 

Magnus

0 Kudos
Message 1 of 7
(230 Views)

Format date/time string with %j as the format code.

Edit:

Example_VI.png

aputman
LabVIEW 2017
LabVIEW Programming
0 Kudos
Message 2 of 7
(225 Views)

There is a function called "Seconds to Date/Time".  It outputs a cluster that has an element for day of the year.  Feed whatever timestamp you want into that function.  Only if you don't wire up a timestamp does it give you the current timestamp.

0 Kudos
Message 3 of 7
(223 Views)

Ok, thats my problem. How can I generate a "whatever timestamp" out of e.g. a date in string-format?

0 Kudos
Message 4 of 7
(216 Views)

If your date format is always the same, you can use Scan From String to convert the string into individual numeric values and then build the cluster into a date/time record and convert that to a timestamp.

aputman
LabVIEW 2017
LabVIEW Programming
0 Kudos
Message 5 of 7
(205 Views)
Solution
Accepted by topic author M.Riede
03-25-2019 01:49 PM

Actually the Scan from String will automatically output the timestamp for you, if you have the proper format code.

Example_VI.png

aputman
LabVIEW 2017
LabVIEW Programming
Message 6 of 7
(197 Views)

Ok, now I found it. The challenge for me was to find the format string and the related vi.

Thank you very much !!

Magnus


 

0 Kudos
Message 7 of 7
(185 Views)