Advanced Search

Results 1 to 3 of 3

Thread: Determining days in any given month

  1. #1
    Join Date
    Jul 2008
    Posts
    65
    Thanks
    42
    Thanked 0 Times in 0 Posts

    Default Determining days in any given month

    Is there a PHP function to give me the days in any given month? For example let's say I want to know how many days are in February for this year. The function will return the number of days that are in February; 28 normally, 28 if it's a leap year.

    Thanks
    Last edited by Snookerman; 05-14-2009 at 05:10 PM. Reason: added “Resolved” prefix

  2. #2
    Join Date
    Sep 2008
    Location
    Bristol - UK
    Posts
    842
    Thanks
    32
    Thanked 132 Times in 131 Posts

    Default

    Yes indeedy there is:

    PHP Code:
    echo cal_days_in_month(CAL_GREGORIAN52009); 
    First parameter is the calendar type, gregorian is standard.

    Then 5 is the month (May), then the year.

    This will return the amount of days in that month for that year: 31.

  3. The Following User Says Thank You to Schmoopy For This Useful Post:

    hosdank (05-14-2009)

  4. #3
    Join Date
    Jul 2008
    Posts
    65
    Thanks
    42
    Thanked 0 Times in 0 Posts

    Default

    Thanks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •