Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 4 of 4
  1. #1
    Senior Member tekp's Avatar
    Join Date
    Jan 2004
    Location
    A small village near a small city near a small cit
    Posts
    918
    Member #
    4667
    Liked
    1 times
    Whenever I try to use the date function with mktime() e.g:

    Code:
    date("Y-m-d",mktime(0,0,0,$month,$day,$year));
    It always comes out with the wrong month, but when I add one to month:

    Code:
    date("Y-m-d",mktime(0,0,0,($month + 1),$day,$year));
    It works fine, and gives the right month.

    Why is this? Is it an actual problem or is it meant to be this way?

    Thanks
    tekp :cheeky: tekponline.com

  2.  

  3. #2
    Senior Member
    Join Date
    Aug 2003
    Posts
    444
    Member #
    2801
    It's probably your server's date/time is set wrongly. PHP simply asks the server.

    Look at your phpinfo() output and see what that says.
    eKstreme
    eKstreme.com - Free website tools!
    fontfox - free fonts Hand-picked quality fonts.

  4. #3
    Senior Member tekp's Avatar
    Join Date
    Jan 2004
    Location
    A small village near a small city near a small cit
    Posts
    918
    Member #
    4667
    Liked
    1 times
    Ok I will, thanks.

    tekp :cheeky: tekponline.com

  5. #4
    Senior Member seanmiller's Avatar
    Join Date
    Sep 2003
    Location
    Glastonbury, UK
    Posts
    868
    Member #
    3263
    Liked
    1 times
    Hmmm...

    You're supplying the month as an argument $month ?

    Where is that variable coming from? The server? Or user input, or where?

    The date should output the same variable in "m" as you supplied in $month. I would suggest the variable is being set incorrectly somewhere else in the script.

    Sean


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 10:46 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com