I'm currently want to create a variable based on the datalogger realtime.
My output format should be YYYYMMDDhhddss
If I'm using the RealTime function to get the nine variables linked to the time, ie YYYY, MM, DD, hh, mm, ss, micros, DOW, DOY and rearrange the output time as folowing :
Public DesiredTime As String *17
DesiredTime = rTime(1) & rTime(2) & rTime(3) & rTime(4) & rTime(5) & rTime(6)
As it, I will get a output realtime that will be sometimes cut due to the presence of non zero front of value. Here is an example :
If time is 2017 12 01 15:09:27, I will get 201712115927 and no 20171201150927.
Do you have a quick solution without using long test to keep a zero when rtime <10?
All the best,
I find it easier to use Status.TimeStamp(4,1) to get the timestamp as a string, then using the MID function to get the formatted pieces that you need.
The help for the syntax is listed in the help index under TableName.TimeStamp
I've tested this solution but get systematicaly a delay, typically 1.08 sec. I think I have to force the seconds to zero.
Then go with your first approach, but use the FormatFloat instruction on each component of the timestamp to have the leading zeroes.
Ok I did it, thank you. I will ask another question on the forum regarding "time slicing" issue ?!?
Another function introduced to help with this is sprintf(), which can be used more simply than Format Float, as with this example:
Public RT(9) As Long, RTStr As String