01-14-2016 08:56 AM
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 ??
Solved! Go to Solution.
01-14-2016 09:15 AM - edited 01-14-2016 09:17 AM
Just let the Format Date/Time String do all of the work...
01-14-2016 09:34 AM
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
01-14-2016 09:35 AM - edited 01-14-2016 09:44 AM
That was pretty fast and exactly what I wanted ! Thansk Crossrulz.
The attached VI works like i wanted !!
01-14-2016 09:43 AM
01-14-2016 09:45 AM
@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 !!