|
FORUMS PROFESSIONNELS WINDEV, WEBDEV et WINDEV Mobile |
| | | | | |
| [WINDEV 19] Data e hora posix |
| Débuté par pedrosao, 21 fév. 2015 12:30 - Aucune réponse |
| |
| | | |
|
| |
Membre enregistré 42 messages |
|
| Posté le 21 février 2015 - 12:30 |
Posix (Unix Timestamp) corresponde ao número de segundos após 01/01/1970.
Procedure ConvDtHo2UnixTime(pDtHo is DateTime)
tmpDtHo is DateTime = pDtHo tmpDtHo..Millisecond = 0
tmpDif is TO string = DateTimeDifference("19700101000000",tmpDtHo)
tmpUnix is Duration = StringToDuration(tmpDif,durationCenti) tmpUnix..Millisecond = 0
RESULT tmpUnix
Procedure ConvUnixTime2DtHo(pUnixTime is numeric) tmpMaxInt4b is int on 4 bytes = 2147483647 tmpSegundos is int on 8 bytes tmpUnix is Duration IF pUnixTime <= tmpMaxInt4b THEN tmpUnix..Second = pUnixTime ELSE tmpSegundos = pUnixTime LOOP tmpUnix..Second += tmpMaxInt4b tmpSegundos -= tmpMaxInt4b IF tmpSegundos < tmpMaxInt4b THEN tmpUnix..Second += tmpSegundos BREAK END END END tmpDtHo is DateTime = "19700101000000" tmpDtHo += tmpUnix
RESULT tmpDtHo
Fonte: Lifetech |
| |
| |
| | | |
|
| | | | |
| | |
| | |
| |
|
|
|