From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

day of the year out of a specific timestamp

Solved!
Go to solution

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
(3,899 Views)

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

Edit:

Example_VI.png

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 2 of 7
(3,894 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
(3,892 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
(3,885 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
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 5 of 7
(3,874 Views)
Solution
Accepted by M.Riede

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

Example_VI.png

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
Message 6 of 7
(3,866 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
(3,854 Views)