Dragen Posted June 30, 2007 Share Posted June 30, 2007 I'm getting a wierd result using the date function along with mktime. here's my code: echo date('M', mktime(0,0,0,2)); Looks simple enough.. For some reason though it outputs 'Mar', but march is the third month. If I switch the 2 with 3 it outputs 'Mar'. All the other months come out correctly, just feb comes out as 'Mar' and I can't figure it out... Quote Link to comment Share on other sites More sharing options...
metrostars Posted June 30, 2007 Share Posted June 30, 2007 I think it's something to do with the day, because it is 0, the month technically hasn't started yet, and February is the leap month, im not exactly sure of the problem tho. Put some phony values for year and day and you should be fine. Quote Link to comment Share on other sites More sharing options...
Dragen Posted June 30, 2007 Author Share Posted June 30, 2007 yeah thanks! I set the day to 1 and it works fine. Thanks Quote Link to comment Share on other sites More sharing options...
king arthur Posted June 30, 2007 Share Posted June 30, 2007 Because you have omitted the day and year parameters they will default to now. Since it's currently 30th June, and you can't have a 30th February, mktime() converts it into March for you. Quote Link to comment Share on other sites More sharing options...
Dragen Posted June 30, 2007 Author Share Posted June 30, 2007 ah okay. Thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.