Re: [PHP] How to determine if date/time is with DST or not ?

2004-08-15 Thread Burhan Khalid
-{ Rene Brehmer }- wrote:
hi gang
I'm trying to find a simple way to determine if a given date/time is with
DST for a given locale at any point in time ... the point is basically to
convert date strings into accurate GMT timestamps for storage in the
database...
http://www.php.net/date
I (capital i)	Whether or not the date is in daylights savings time	1 if 
Daylight Savings Time, 0 otherwise.

[ snipped rest ]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] How to determine if date/time is with DST or not ?

2004-08-15 Thread -{ Rene Brehmer }-
which tells you if the locale where the server is was in DST or not on that
date - atleast if I understand the PHP documentation right... since the
timestamps don't contain locale info ... I wanna know if a specific locale
was in DST on that given date  

I hate having to work with dates ... I know it basically requires to code
the dst days for the entire globe into the system, but had hoped someone had
already done that  as much as I hate using others code, this is one
thing I'd rather avoid having to program...


Documented research indicates that on Sun, 15 Aug 2004 10:31:17 +0300,
Burhan Khalid wrote about Re: [PHP] How to determine if date/time is with
DST or not ?:

-{ Rene Brehmer }- wrote:

 hi gang
 
 I'm trying to find a simple way to determine if a given date/time is with
 DST for a given locale at any point in time ... the point is basically to
 convert date strings into accurate GMT timestamps for storage in the
 database...

http://www.php.net/date

I (capital i)  Whether or not the date is in daylights savings time1 if 
Daylight Savings Time, 0 otherwise.

[ snipped rest ]

-- 
Rene Brehmer
aka Metalbunny

If your life was a dream, would you wake up from a nightmare, dripping of sweat, 
hoping it was over? Or would you wake up happy and pleased, ready to take on the day 
with a smile?

http://metalbunny.net/
References, tools, and other useful stuff...
Check out the new Metalbunny forums at http://forums.metalbunny.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] How to determine if date/time is with DST or not ?

2004-08-14 Thread -{ Rene Brehmer }-
hi gang

I'm trying to find a simple way to determine if a given date/time is with
DST for a given locale at any point in time ... the point is basically to
convert date strings into accurate GMT timestamps for storage in the
database...

Like I've got date strings looking like:

Thursday, July 22, 2004 8:50:01 PM 
July 22, 2004 6:42 PM 

the strings are submitted through a form, together with a variable
determining the time zone these times are in. I just want to figure out if
the dates are with or without dst for that locale, at that given time, so
that I can properly convert them to GMT times ... but I have no clue how to
do that ... haven't been able to find anything useful in the manual or the
PHP Cookbook ... the time zone is submitted negative of the actual value ...
so a time offset of -0700 is submitted as +7 and +0200 as -2 ... this is
simply to make the time conversion simpler...

these are extracts of the current time calculation codes, including some
debugging code for the time conversion:

?php
  $date = $_POST['date'];
  $tzone = $_POST['tzone'];

  $timestamp = strtotime($date);
  
  if ($tzone != 'none') {
$tdif = $tzone.' hours';
$timestamp = strtotime($tdif,$timestamp);
  }
?

/* the following part is an extra of a larger table ... the formatting of
the time zone is merely for displaying purposes atm. The goal is to create
RFC2822 dates to be stored in the database alongside messages...
*/

tdWorkdate: ?php echo($date.' '.$tzone); ?br
  Time difference: ?php
if ($tzone  0) {
  $format = '-';
} else {
  $format = '+';
}
if (abs($tzone)  9) {
  $format .= '%u00';
} else {
  $format .= '0%u00';
}
printf($format,abs($tzone)); ?br
  Unix timestamp: ?php echo($timestamp); ?br
  GMT date: ?php echo(date('D, d M Y H:i:s',$timestamp)); ?/td


if anyone has any ideas for determining whether DST is on or off, I'd
appreciate it. right now I have no clue how to do this the easiest...

TIA

Rene
-- 
Rene Brehmer
aka Metalbunny

If your life was a dream, would you wake up from a nightmare, dripping of sweat, 
hoping it was over? Or would you wake up happy and pleased, ready to take on the day 
with a smile?

http://metalbunny.net/
References, tools, and other useful stuff...
Check out the new Metalbunny forums at http://forums.metalbunny.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php