views:

501

answers:

3

We are creating a unix timestamp with the mktime method giving following attributes:

print_r(mktime(0,0,0,3,1,2009));
print_r(mktime(null,null,null,3,1,2009) / 60 / 60 / 24) . "days");`

this creates a result of

1235862000

14303.958333333 days

this should be 14304 days. The problem in this case is the winter hour. You can use the is_dst parameter, and when we use 0 (default -1) this sometimes works correctly giving 14304 days as a result.

But sometimes this gives following problem:

Strict Standards: mktime() [function.mktime]:The is_dst parameter is deprecated

i have no idea what it means and what i can do about it. Any idea someone? because the winter hour is causing terrible head ache....

+1  A: 

Use gmmktime.

vartec
+2  A: 
date("I", time());

Will give you 1 if its daylight savings and 0 if its not.

Ólafur Waage
+2  A: 

From the php manual page:

"Every call to a date/time function will generate a E_NOTICE if the time zone is not valid, and/or a E_STRICT message if using the system settings or the TZ environment variable. See also date_default_timezone_set()"

that probably means you should use date_default_timezone_set() previously and skip the is_dst parameter

jcinacio