LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Timestamp to Byte Array

Is there a control to convert a timestamp into a byte array. I have a cluster payload with 7bytes of data that I need to load with month,day,year,H,M,S. I'm using the Format-Date Time function to get each individual time/date setting. Now I need to convert each string to a numeric byte. If I typecast each string to a U8 I get the ASCII value versus the actual value. There has got to be an easier way of doing this. Any ideas?

 

Thanks...

 

0 Kudos
Message 1 of 8
(7,457 Views)

Hey,

 

Is it the String to Byte Array function you are looking for?

 

Be careful with your terminology.  Controls and indicators are front panel objects and exist on the block diagram as terminals.  The yellow colored blocks are called functions and exist on the block diagram.

 

Kind Regards

 

 

Lewis Gear CLA
LabVIEW UAV

0 Kudos
Message 2 of 8
(7,452 Views)

The String to Byte Array function won't work, since it returns the ACSI Value of the string data. For example if I extract the month from the timestamp which is say 8, I need the string value converted to a numeric 8 not the acsi value for 8. So what I need is a string to INT in numeric form. I could subtract the ACSII value out, but I'm sure there's a function to do this 😃

 

Thanks again.

0 Kudos
Message 3 of 8
(7,448 Views)

Hey,

 

Maybe it is this you are looking for?

String to numeric.png

 

Kind Regards

Lewis Gear CLA
LabVIEW UAV

0 Kudos
Message 4 of 8
(7,443 Views)

Exactly 😃 Thanks so much!

0 Kudos
Message 5 of 8
(7,436 Views)

There's actually a function called Seconds to Date/Time which will give you direct access to the time record in terms of month, year, day, etc. without requiring you to do any string parsing. It should be much more robust. Is this what you need? The function is in the main Timing palette.

 

TimeArray.png

Jarrod S.
National Instruments
Message 6 of 8
(7,418 Views)

Hi QRP,

             I think this will work for you.

          

   

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Thanks as kudos only:)
0 Kudos
Message 7 of 8
(7,397 Views)

@danil33 wrote:

Hi QRP,

             I think this will work for you.

          

   


As much as I like seeing somebody re-post my code, I think Jarrod has the correct answer in this case.


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
0 Kudos
Message 8 of 8
(7,369 Views)