Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#12894 closed defect (bug) (invalid)

mktime inconsistent between 2.9 and 3.0

Reported by: arena Owned by: arena
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)

comment:1 follow-up: ↓ 2   scribu3 years ago

  • Keywords reporter-feedback added; dev-feedback removed

The second one appears to be correct, so what's the problem?

It's probably the effect of [12727]

comment:2 in reply to: ↑ 1   arena3 years ago

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 set to invalid
  • Status changed from new to closed

comment:5 follow-up: ↓ 6   scribu3 years ago

  • Milestone 3.0 deleted

So what was the issue?

comment:6 in reply to: ↑ 5   arena3 years ago

  • 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

comment:8   ryan3 years ago

3.0 sets the timezone used by PHP to UTC. If you want local time you have to use current_time(). See [12727].

comment:9   ryan3 years ago

  • Resolution set to invalid
  • Status changed from reopened to closed

Hi ryan

one question :

setcookie and time() ???

shouldn't it be

setcookie and current_time('timestamp')

??

Note: See TracTickets for help on using tickets.