LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Auto generation of File Name with Date stamp

Solved!
Go to solution

Please see the attached VI. ( LV2012)

 

What i want that to do is to generate a file name in the format : DayOfYear - Month - Date - Year . txt

 

The way I have coded it, I was able to genarate as per my requirement. For example today it generated a file name "14-1-14-2016.txt " on my computer.

 

But the same code when run on the client computer generated this : 14-1/-4/-016 .txt and obviously the VI stopped due to the illegal file name. I gues this is beacuse the way each computer formats the date , time information.

 

How to code a generic VI to create the file name as i require on any computer ??

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

Just let the Format Date/Time String do all of the work...


GCentral
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 2 of 6
(3,680 Views)

The problem with your code is in the Replace Substring.  It will work when the month has 2 digits but will fail when there is one digit.  That's why it worked in December but failed in January.  You're replacing the third and sixth character with a dash.

 

12/25/2015   -    Works

1/15/2016    -    Doesn't work

aputman
0 Kudos
Message 3 of 6
(3,661 Views)

That was pretty fast and exactly what I wanted ! Thansk Crossrulz.

 

The attached VI works like i wanted !!

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 4 of 6
(3,659 Views)

Personnaly I much prefer the use of %Y-%m-%d. When you sort by name the files also get sorted by date.

 

Ben64

 

 

Message 5 of 6
(3,647 Views)

 

 


@ben64 wrote:

Personnaly I much prefer the use of %Y-%m-%d. When you sort by name the files also get sorted by date.

 

Ben64

 

 
Yes you are right Ben. Good idea !!

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 6 of 6
(3,643 Views)