Jump to content

[SOLVED] mktime appears to not work.


MadnessRed

Recommended Posts

Hi, I have never really used mktime, I usually only input dates as unix timestamps but I was being a bit lasy today so though I would just use the mktime function rather than converting them.

 

Anyway here is my code

$dates = array(
mktime(0, 0, 0, 03, 29, 2009),
mktime(0, 0, 0, 04, 05, 2009),
mktime(0, 0, 0, 04, 19, 2009),
mktime(0, 0, 0, 04, 26, 2009),
mktime(0, 0, 0, 05, 10, 2009),
mktime(0, 0, 0, 05, 24, 2009),
mktime(0, 0, 0, 06, 07, 2009),
mktime(0, 0, 0, 06, 21, 2009),
mktime(0, 0, 0, 07, 12, 2009),
mktime(0, 0, 0, 07, 26, 2009),
mktime(0, 0, 0, 08, 23, 2009),
mktime(0, 0, 0, 08, 30, 2009),
mktime(0, 0, 0, 09, 13, 2009),
mktime(0, 0, 0, 09, 27, 2009),
mktime(0, 0, 0, 10, 04, 2009),
mktime(0, 0, 0, 10, 18, 2009),
mktime(0, 0, 0, 11, 01, 2009),
);

foreach ($dates as $ts){
echo date("r",$ts)."<br />";
}

 

And here is the output.

 

Sun, 29 Mar 2009 00:00:00 +0100

Sun, 05 Apr 2009 00:00:00 +0200

Sun, 19 Apr 2009 00:00:00 +0200

Sun, 26 Apr 2009 00:00:00 +0200

Sun, 10 May 2009 00:00:00 +0200

Sun, 24 May 2009 00:00:00 +0200

Sun, 07 Jun 2009 00:00:00 +0200

Sun, 21 Jun 2009 00:00:00 +0200

Sun, 12 Jul 2009 00:00:00 +0200

Sun, 26 Jul 2009 00:00:00 +0200

Tue, 23 Dec 2008 00:00:00 +0100

Tue, 30 Dec 2008 00:00:00 +0100

Sat, 13 Dec 2008 00:00:00 +0100

Sat, 27 Dec 2008 00:00:00 +0100

Sun, 04 Oct 2009 00:00:00 +0200

Sun, 18 Oct 2009 00:00:00 +0200

Sun, 01 Nov 2009 00:00:00 +0100

 

The ones I coloured red for some reason have become 2008? What is going on?

Link to comment
https://forums.phpfreaks.com/topic/151454-solved-mktime-appears-to-not-work/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.