|
| Convert string milliseconds in date |
| Iniciado por Leonardo Bidi, 18,abr. 2018 22:32 - 2 respuestas |
| |
| | | |
|
| |
Miembro registrado 18 mensajes |
|
| Publicado el 18,abril 2018 - 22:32 |
Hi.. I have a string with milliseconds format, that its returned from a web service that I need to convert to date.
for ex the string is "201804181084313", how can I convert it to a valid date ?
Thanks. |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 16 mensajes |
|
| Publicado el 27,abril 2018 - 19:31 |
Hi lbidi
from your string: 2018 - year 04 - month 18 - day 10 - hour 84 - minute??? that string is surely not correct but if it was, it would be something like this:
sTest is string="20180427182414836"
dDate is Date tTime is Time
dDate=Left(sTest,8) tTime=Middle(sTest,9)
Info("Date: "+DateToString(dDate,"DD/MM/YYYY")+CR+"Time: "+TimeToString(tTime,"HH:MM:SS:CC"))
"20180427182414836" 2018 - year 04 - month 27 - day 18 - hour 24 - minutes 14 - seconds 836 - milliseconds |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 18 mensajes |
|
| Publicado el 27,abril 2018 - 20:31 |
Hi Jose.. That example was not valid, I just made up for the post.
I've resolved my problem with this..
rNumber is the value that the web service returns , its a date value in milliseconds format.
dToday..Second += ( rNumber / 1000 ) then in dTotay..Date , I have the date I was looking for.
Many Thanks anyway !!Mensaje modificado, 27,abril 2018 - 20:33 |
| |
| |
| | | |
|
| | | | |
| | |
|