LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

convert time format

Solved!
Go to solution

I'm writing an Labview application in which i read date data from a file which is on this format :   11 Apr 2010

 

I want to convert this format to another like this 11-4-2010. I use the "Scan From String" function but i couldn't make the conversion.

 

0 Kudos
Message 1 of 11
(4,598 Views)

Set the format for the timestamp indicator as shown in the comment.

 

Message Edited by Ravens Fan on 04-11-2010 08:37 PM
Message 2 of 11
(4,589 Views)
Hi Ravens thank you for your quick help.
I  try it today on my labview version 8.5.1 but i couldn't make it works on my computer !
0 Kudos
Message 3 of 11
(4,550 Views)

Kudos for using the Code Capture Tool to make the snippet :).

 

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Message 4 of 11
(4,546 Views)

Grazanis, what happens if you format a timestamp like you 'scanned' it?

The %b abbreviation is localized, meaning it  is dependent on the language setting of the computer.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 5 of 11
(4,519 Views)

What is it doing or not doing?  Any error messages?

 

Here is that snippet saved back to LV 8.5.  Try that.

Message 6 of 11
(4,513 Views)

Thank all of you for the help again.
The vi runs normal with no errors. I try and your .vi Ravens Fan  which is the same like this i have made.
On the front panel the output 1 is DD-MM-YYYY and not 11-4-2010.

TCPlomp  if it is dependent on the language setting of the computer how can i change it. I have win vista with greek language.
I want to make it on this format (11-4-2010) because then i want to make this number 20100411 and make comparisons.

The numbers are more flexible with mathematics functions.Smiley Wink

0 Kudos
Message 7 of 11
(4,458 Views)

It works fine for me in LV 8.5.1.  Though the month comes out as 04 and not 4.  I personally prefer 1 digit months and days and 2 digit years.  So 4/11/10 for April 11, 2010.  According to the help file "Format Codes for the Time Format String" it appears you can only have 2-digit months and days.  So single digiti months and days will have a leading zero.  But if you are doing further conversions to rearrange the data further, then you probably want to have that.

 

Are you getting any error messages?  Put an erro indicator on the conversion function.  I think Ton is right that if you are using Greek Vista, you will have to use the Greek abbreviation for April to get it to work.

Message 8 of 11
(4,439 Views)

Yes you have right i put the Apr with greek characters "Απρ" and i take the month 04.

So first i must hane a sub.vi to change the english abbreviations for months with greek abbreviations on my file.

 

Thank you for your help !

Where i must push solution button ? (on TCPlomp  or Ravens Fan )

0 Kudos
Message 9 of 11
(4,417 Views)
Solution
Accepted by granazis

I don't think there's a function to match a localized string in a different language.

There are two options:

  1. Use a VI to replace your english months with greek months
  2. Set the language of the computer to english
Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 10 of 11
(4,399 Views)