Showing results for 
Search instead for 
Did you mean: 

How to input the words Date and Time into the File Format String?

Go to solution

So right now I have a VI in which when you click Save it saves the current state of the Front Panel as a Jpeg. That all works fine. But I wanted to automatically save the file as the current date by using -%y-%d-%H-%M-%S. That also works fine. The only problem? When saved the name of the file looks like a bunch of random numbers.

Ex. 2017-08-28-12-54-19. 


Technically this is fine. It's correct. But it looks like crap. Is there a way I can modify the File Format String so that the final file reads "Date: 2017-08-28 Time: 12-54-19"?

0 Kudos
Message 1 of 18

Well you probably don't want (or aren't allowed) to have colons in the filename. But there is a function called "format into string". For the format string you can use any words then "%s" as a placeholder. Since your date has 10 characters always, you can just split your string after 10 characters and use "Date %s Time %s" with the first input being your date and the second being time.


Personally, when I collect data during the test it often looks like "20170828_143518_Voltages" for example, and it is easy for me to know the first 8 characters are the date and the next 6 after the underscore are time.

0 Kudos
Message 2 of 18
Accepted by ShogunOrta

@ShogunOrta wrote:

Ex. 2017-08-28-12-54-19

I typically go with something more like "2017-08-28 12-54-19".  That space makes a good separation between the Date and the Time.  But to answer your question:

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 18

Is that function you used there a Time Stamp function?

0 Kudos
Message 4 of 18

Hey, thanks for that. wouldn't know how to insert a ":" so that the time looks like 14:32:12, rather than 14-32-12?

0 Kudos
Message 5 of 18

Hi Orta,


the colon is one of those chars not allowed in filenames...

Best regards,

using LV2020 on Win8.1+cRIO
0 Kudos
Message 6 of 18
Accepted by ShogunOrta

While the colon ":" is not permitted, oddly enough, the semi-colon ";" is permitted as part of a filename.  Just replace the "-" after the %H and %M with the semicolon ";" for a close visual approximation.

Help the Community (and future reviewers) by marking posts as follows:
If it helped - KUDOS
If it answers the issue - SOLUTION
Message 7 of 18

Yep, that'll work. But I've been looking around the net and have found several examples of Date formatting codes that supposedly give you the current time with colons included. I've tried %T, %t, %X, %x, %Z, %z, and on and on, but nothing works. Does Labview actually have anything like that? Maybe I'm just implementing it wrong. 

0 Kudos
Message 8 of 18

The default (unwired) is %c. If you want just the time in 24-hour format you can use "%H:%M:%S"

0 Kudos
Message 9 of 18

But in "%H:%M:%S", my Labview doesn't seem to accept the colons. I have 2015 though.

0 Kudos
Message 10 of 18