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: 

Two consequtive Date Files generation

Solved!
Go to solution

I have a requirement to search for date files in a data log application.

 

The files are generated and stored in the format < DayOfYear-DD-MM-YYYY.TXT>

 

And the added requirement is the user will enter the information to genearte the first date and I need to auto-generate the next day file reference. That is where the problem is. While I have evolved logic to automatically create the DayOfYear number  (on Dec 31st it will generate 01 as the next DayOfYear ) I dont think its easy to do the same for  the date. I guess it needs to handle things like leap year and months with 30 days etc.

 

Any simple ideas to do the above ? Enclosing my VIs . ( LV2012 version).

 

Thanks in advance.

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
Download All
0 Kudos
Message 1 of 15
(3,288 Views)

Hello,

 

The time stamp data type in LabVIEW is actually DBL in seconds , so if you want to know what will be the date tomorrow, you get a time stamp, add 86400 (number of seconds per day), see this :

2016-02-15_154646.jpg


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 2 of 15
(3,274 Views)

Great ...i suppose this will automatically handle the roll over on 31st December ? All three - date / month/year have to increment..

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 3 of 15
(3,271 Views)
Solution
Accepted by topic author MogaRaghu

see for yourself :

 

2016-02-15_155432.jpg

 

EDIT :

And it deals with leap years as well 😉


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

Message 4 of 15
(3,257 Views)

Thanks. Have a good day !!

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 5 of 15
(3,250 Views)

You can try something like this. How you get the timestamp at the beginning is up to you. The key is in the "format into text string", it is very flexible. I also like to use the unit conversion, because it is easy to see that I convert 1 day to seconds and add it to the timestamp.

 

Format Timestamp.png

Message 6 of 15
(3,247 Views)

Hi Moga,

 

i suppose this will automatically handle the roll over on 31st December ? All three - date / month/year have to increment..

LabVIEW knows how to calculate using timestamps…

If you don't trust you can always try out with a simple test VI!

 

Ooops, late post. Always refresh the page before answering a post…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 15
(3,240 Views)

>>LabVIEW knows how to calculate using timestamps…

 

Long live LabVIEW !!Smiley Very Happy

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 8 of 15
(3,235 Views)

gregoryj :

 

Wow...its raining solutions today.

 

Yes I can use this also - but I have not so far used Expression Nodes and I dont quite follow whats inside them.. are you converting one day to seconds and then using the output ??

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 9 of 15
(3,225 Views)

SO here is the new condensed VI that does all that I wanted.

 

Thanks to all those who supported so fast !!

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 10 of 15
(3,205 Views)