|
PROFESSIONAL NEWSGROUPS WINDEV, WEBDEV and WINDEV Mobile |
| | | | | |
[WINDEV 19] Data e hora posix |
Started by pedrosao, Feb., 21 2015 12:30 PM - No answer |
| |
| | | |
|
| |
Registered member 42 messages |
|
Posted on February, 21 2015 - 12:30 PM |
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 |
| |
| |
| | | |
|
| | | | |
| | |
| | |
| |
|
|
|