LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

format date/time string convert into number

Hi 2 everyone. I want to ask 1 question. how could I convert date/time string into number.that mean all parameter in string can show also in number.Such as 22/11/07 in string show in number like 221107 or else.thank u....here i attach my example..
0 Kudos
Message 1 of 9
(5,196 Views)

All you need is to format the date string.  Formatting info can be obtained from the Context Help.  See the attached image:

(Note: I couldn't open you vi because I did not have LV8.5 installed on this PC).

Message Edited by JoeLabView on 09-06-2007 07:40 PM

Message 2 of 9
(5,192 Views)
Hi Joe....

Thank u very much Joe.U give me the point.Now I know that I should learn more about format string.I'm so sorry about the file vi that I attached it before.I didn't realize this file should use in 8.5.Here I send it again in 7.1 version.hope u fix me where I'm wrong...

This program..I just try to convert this string into number.but i'm not really sure that date/time string can convert into string.I create a loop so that i can build an array to extract the value from string n using a function such as decimal string to number to convert this string into number element. but the result was nothing happen  after I click the run button..Till now I stuck here...Thank u...Smiley Happy
0 Kudos
Message 3 of 9
(5,166 Views)
Why don't you simply use the example Joe posted? Take the string and wire that to a Scan From String with a %d format string.
Message 4 of 9
(5,164 Views)
Hi Dennis...

Thanks for ur reply.I feel the same with u too..Its a best way if we can simplify it. But with this function. Its only limit with one movement.But of course that u can make it.I'm really like to look it move simultaneously n merge with a signal.That's why I want  it to convert  into number...I need to learn bout  how can string -number,number - string,array - cluster, n else...it's important to my future references.thank u very much....Smiley Happy
0 Kudos
Message 5 of 9
(5,157 Views)

Good morning takimi,

I just looked at your code, and I don't seem to understand what you are trying to do.

You're breaking down the date stamp to each of it's component and storing each element into an array.  The you subtract "Y"...  What is "Y"? 

The other question is why are you doing this?  What is the ultimate goal that you are trying to achieve?  What is "element"?

Sorry for so many questions, but until we understand what you are trying to do, it is difficult to suggest anything.

Regards,

RayR

Message 6 of 9
(5,143 Views)
Good Morning Joe...

I just looked at ur msg.Wow...after u ask me like that...Now, I'm feel scared n flurried .Hehe....just kidding...actually, I didn't have any true goal about my question.all I want to do is just to try n error.So, I want to use this function  to write data into file.Below, I attach 2 picture here.Not a good prog but just the examples.In pic red2red jpg, i'm using this format date/time  string  connect to the concatenate strings with tab constant n the parameter values in array to spreadsheet string. N its write such as:

(dd/mm/yy  hh/mm/ss)1   value1   value1.2
(dd/mm/yy  hh/mm/ss)2   value2   value2.2
(dd/mm/yy  hh/mm/ss)3   value3   value3.2
(dd/mm/yy  hh/mm/ss)4   value4   value4.2
(dd/mm/yy  hh/mm/ss)5   value5   value5.2          so the date n time is running like it should and simultaneously

Now, I want to try to use this function and connected to the express function like write to data  measurement file.look at the pic red2blue.jpg.There are 4 link connect to the merge signal.Before that I should convert the time string into number first.So, i have tried the example like u said before.but it seems didnt work properly.the numbers didn't run and static with the first value like this:

elapsed time       value x      value y      hh/mm/ss
0.000000            0.000000    0.000000    144027.000000   
0.031250            0.000000    0.000000    144027.000000   
0.046875            0.000000    0.000000    144027.000000   
0.078125            0.000000    0.000000    144027.000000   
0.093750            0.000000    0.000000    144027.000000   
0.125000            0.000000    0.000000    144027.000000   
0.156250            0.000000    0.000000    144027.000000   
0.171875            0.000000    0.000000    144027.000000   

So, this is the situation of my problem.I'll try to create an array n etc. sorry about the "element" n subtract 'Y'. This is out of my idea.This is the goal that I'm trying to achieve.I hope u understand about this.thank u very much.Smiley Happy

Download All
0 Kudos
Message 7 of 9
(5,108 Views)
Hi Takimi,
I don't think merge signal is the correct VI to use to achieve what you want to do.  You probably want to do Build Waveform.vi under Program->Waveform on your block diagram.  Please refer to the detailed help on how to use build waveform correctly.  After you build your waveform, you can pass value directly to Write to Measurement VI.

Yi Y.
Applications Engineer
National Instruments
http://www.ni.com/support
0 Kudos
Message 8 of 9
(5,040 Views)

I agree with Yi.

I don't understand why you are using the signal merge.  It's still not clear what  you wanted to do in that second example.

Sorry..

0 Kudos
Message 9 of 9
(5,019 Views)