#12894 closed defect (bug) (invalid)
mktime inconsistent between 2.9 and 3.0
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | General | Version: | 3.0 |
| Severity: | normal | Keywords: | reporter-feedback |
| Cc: |
Description
on the same pc, same environment :
with 2.9
mktime( 0, 0, 0, 04, 8, 2010 ) gives 1270677600 (Wednesday, April 7th 2010, 22:00:00 (GMT))
with 3.0beta1
mktime( 0, 0, 0, 04, 8, 2010 ) gives 1270684800 (Thursday, April 8th 2010, 00:00:00 (GMT))
Change History (10)
- Keywords reporter-feedback added; dev-feedback removed
Replying to scribu:
The second one appears to be correct, so what's the problem?
It's probably the effect of [12727]
My PHP settings are (php.ini)
[Date] ; Defines the default timezone used by the date functions date.timezone =Europe/Paris
and my wordpress settings are :
Timezone : Paris which is equivalent to UTC+2
UTC time is 2010-04-07 20:34:07 Local time is 2010-04-07 22:34:07
The first is the right one (http://fr.php.net/mktime).
so the 04/08/2010 00:00 local time is 07/04/2010 22:00:00 GMT
sorry, last line of my previous post should be
so the 04/08/2010 00:00 local time is 04/07/2010 22:00:00 GMT
retauring [12727] doesn't change a thing !!!
- Resolution invalid deleted
- Status changed from closed to reopened
Replying to scribu:
So what was the issue?
still don't know, i made several attempts to have my plugin code as clean as possible and the error remains.
in 2.9 for same date mktime and gmmktime gives different timestamps
mktime( 0, 0, 0, 4, 8, 2010 ) : 1270677600
gmmktime( 0, 0, 0, 4, 8, 2010 ) : 1270684800
in 3.0 for same date mktime and gmmktime gives SAME timestamps
mktime( 0, 0, 0, 4, 8, 2010 ) : 1270684800
gmmktime( 0, 0, 0, 4, 8, 2010 ) : 1270684800
still don't know, i made several attempts to have my plugin code as clean as possible and the error remains.
in 2.9 for same date mktime and gmmktime gives different timestamps
mktime( 0, 0, 0, 4, 8, 2010 ) : 1270677600
gmmktime( 0, 0, 0, 4, 8, 2010 ) : 1270684800
in 3.0 for same date mktime and gmmktime gives SAME timestamps
mktime( 0, 0, 0, 4, 8, 2010 ) : 1270684800
gmmktime( 0, 0, 0, 4, 8, 2010 ) : 1270684800
3.0 sets the timezone used by PHP to UTC. If you want local time you have to use current_time(). See [12727].
comment:10
arena — 3 years ago
Hi ryan
one question :
setcookie and time() ???
shouldn't it be
setcookie and current_time('timestamp')
??

The second one appears to be correct, so what's the problem?
It's probably the effect of [12727]