problems with date/time functions

From: Georg Horn (horn@koblenz-net.de)
Date: Thu Oct 07 1999 - 21:04:24 EST


Hi List,

I have a problem with converting date/time from unix-format (Seconds since
1.1.1970) to msql-format and back.

The following script demonstrates this:

---cut---
#!/usr/local/Hughes/bin/lite

$ctime = "12:12:12";
echo("time is $ctime\n");

$cdate = "12-Dec-1999";
echo("date is $cdate\n\n");

$time = msqlTimeToUnixTime($ctime);
echo("time to unix time is $time\n");

$date = msqlDateToUnixTime($cdate);
echo("date to unix time is $date\n");

$sum = $time + $date;
echo("date+time is $sum\n\n");

$ctime=msqlUnixTimeToTime($sum);
echo("Unix time to time is $ctime\n");

$cdate=msqlUnixTimeToDate($sum);
echo("Unix time to date is $cdate\n");
---cut---

The output of this script is:

---cut---
time is 12:12:12
date is 12-Dec-1999

time to unix time is 40332
date to unix time is 944953200
date+time is 944993532

Unix time to time is 11:12:12
Unix time to date is 12-Dec-1999
---cut---

If i change the start date to 12-Jun-1999, the output is correct.
Am i missing something with daylight savings time and timezones, or
is there a bug?

(Yes, i use 2.0.11)

Bye,
Georg

-------------------------------------------------------------------------
To unsubscribe, go to http://www.Hughes.com.au/extras/email/



This archive was generated by hypermail 2b30 : Mon Mar 04 2002 - 09:03:51 EST