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.
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.
02-15-2016 08:29 AM
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.
Solved! Go to Solution.
02-15-2016 08:47 AM
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 :
We have two ears and one mouth so that we can listen twice as much as we speak.
Epictetus
02-15-2016 08:50 AM
Great ...i suppose this will automatically handle the roll over on 31st December ? All three - date / month/year have to increment..
02-15-2016 08:55 AM - edited 02-15-2016 08:56 AM
see for yourself :
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
02-15-2016 08:57 AM
Thanks. Have a good day !!
02-15-2016 08:57 AM - edited 02-15-2016 08:59 AM
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.
02-15-2016 09:01 AM - edited 02-15-2016 09:02 AM
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…
02-15-2016 09:03 AM
>>LabVIEW knows how to calculate using timestamps…
Long live LabVIEW !!
02-15-2016 09:07 AM
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 ??
02-15-2016 09:30 AM
SO here is the new condensed VI that does all that I wanted.
Thanks to all those who supported so fast !!