08-12-2021 07:33 PM
Hi, I trying to create a TDMS file which changes his name according to date. For example. Sam finished her analysis on 12/08/21 (dd/mm/yy) at 19h25. Then, her file name must be something similar like this:
12-08-21-19-25.TDMS
It doesn't really matter if this format changes the important is creating different files with date and time.
It could be:
12-08-21_19-25.TDSM
1208211925.TDSM
Or maybe in another different way.
I hope you can help me. I'm a labview beginner 😀
Solved! Go to Solution.
08-12-2021 07:47 PM
Hi, I trying to create a TDMS file which changes his name according to date. For example. Sam finished her analysis on 12/08/21 (dd/mm/yy) at 19h25. Then, her file name must be something similar like this:
12-08-21-19-25.TDMS
It doesn't really matter if this format changes the important is creating different files with date and time.
It could be:
12-08-21_19-25.TDSM
1208211925.TDSM
Or maybe in another different way.
I hope you can help me. I'm a labview beginner 😀
08-13-2021 12:41 PM
You can used Format into String on the timestamp and look at the special format codes for date and time.
If I were you, I'd consider doing it in a YYMMDD rather than day first like yyou have. That way when you sort the file names alphabetically, you'll be sorting them by date as well with the oldest files first and newest files last.
I don't have LabVIEW in front of me to check, but the format string would be something like %<%yymmdd_HHMMSS.tdms>T
08-13-2021 01:46 PM
Change d, m,y as needed.
08-15-2021 04:50 PM
I had a colleague who embedded the Date in the File Name -- it drove me crazy! All those characters required to represent the file's name, and the only information it carries is when the file was created, not what "Experiment" it was, what "Test #" it represents, the "ID of the Subject", something that might be relevant to the data contained in the file.
There are two ways to get the date of the file without putting it in the filename. First, simply write it as an element in the file (this works especially well for Text files, XML files, or other things where "Date" might be a "natural" data element). This is what you should do if the date/time are really important, otherwise you are going to have to "deduce" the date/time by parsing the file name, which can get a bit messy.
Second, when you save a file, Windows saves its Creation Date as part of the Directory Entry. Note that File Dates are easily sorted by Window's File Explorer if you just want to "find the oldest" (or newest).
So think carefully when you are deciding on a File-Naming convention.
Bob Schor 17:30 15 August 2021
08-16-2021 10:14 AM
what does "%s" means when you use format into string?
08-16-2021 10:41 AM - edited 08-16-2021 10:43 AM
It's the placeholder for a string.
But Bonkerz example is a little bit of a Rube Goldberg because the Format into string function will take the timestamp direction when you use the timestamp format code.