SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist
    Join Date
    Jan 2005
    Location
    UK
    Posts
    539
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Alternative convert month number to name

    I have a distinct php mysql query that grabs the MONTH(date_live) as 'month'

    I use:

    PHP Code:
    $month_name date('F'mktime(000$row['month']) ); 
    ...to turn the month number > month name.

    This worked flawlessly until recently, now certain months don't convert!

    Is there an alternative method to convert the month number > name without using mktime (in case somehoe that's depreciated??)

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,496
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    You could try to add a valid value for day and month to that mktime.
    Or you could get the name of the month directly in your query: http://dev.mysql.com/doc/refman/5.5/...tion_monthname

  3. #3
    SitePoint Evangelist
    Join Date
    Jan 2005
    Location
    UK
    Posts
    539
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually I just figured a workaround, where I use strtotime on year/month/01


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
  •