UnixToDateTime, czy zawsze dobrze działa?

0

Cześć, poczytałem trochę w necie i teraz tak.
Znalazłem informacje, że przy konwersji powinienem zbadać strefę czasową.

Wiem, jaka funkcja do tego służy, ale co dalej, to nie mam pojęcia, teraz:

UnixToDateTime(Value)

zwraca prawidłowy czas. Zastanawiam się jednak, co się stanie, gdy przejdziemy na czas zimowy. Czy nadal ta funkcja będzie działać, czy będą z tym problemy i jakoś to powinienem zmodyfikować?

0

http://4programmers.net/Delphi/UnixToDateTime
http://4programmers.net/Delphi/Modu%C5%82y/DateUtils/DateTimeToUnix

hi! i've a calendar database, made with php and mysql.

september, 15th. 8:00 is in php: 1063606200
if you convert this value with UnixToDateTime it results 37879,2569444444

now the problem: StrToDateTime ('15.09.2003 800');

results 37879,3333333333

where does this diffrence come from ?

when trying to convert DElphi Time to Unix time I have a permanent
diffrence of 3600.

i already checked my timezone settings. i have no idea what
the problem might be.

ItsMe

well, some time ago i found that there's a difference (6600, not 3600!) between php and delphi unix/time functions....
I've tried all possible convertions from unix to time and time to unix in delphi and in php also and always the results where right in delphi and in php but trting to pass a php to delphi or vice-versa there was always this 6600 difference...
So, as i know that delphi functions works with Int64 (64 bits integer variables) i assume that maybe php work with 32 bits and so the functions aren't realistics but works fine just working only in php...

My solution was to add this const to my convertions from php to delphi...

i.e.

const
PHPBetweenDelphi = 6600;

so
function delphitimetoUnixphp(Value: TDateTime): Int64;
begin
result := DAteTimeToUnix(value)-PHPBetweenDelphi;
end;

and
procedure PHPUnixToDelphiTime(Value: Int64): TDateTime;
begin
result := UnixToDateTime(Value+PHPBetweenDelphi);
end;

http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_20744229.html

Nic konkretniejszego nie zastałem chyba jedyna metoda to spróbować inaczej się szczegółów nie dowiemy.

0

Czytałem to wszystko, co mi dałeś już wcześniej. Ale nic z tego nie odpowiada na moje pytanie.

1 użytkowników online, w tym zalogowanych: 0, gości: 1