Web Analytics Made Easy -
StatCounter Reformatting Date: 20060123 to January 23, 2006. - CodingForum

Announcement

Collapse
No announcement yet.

Reformatting Date: 20060123 to January 23, 2006.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Reformatting Date: 20060123 to January 23, 2006.

    Hey folks...

    I'm stumped and don't know how to handle transferring a yyyymmdd string to a long-formatted date.

    I have a date field in the YYYYMMDD format and need to transfer it to
    Month Day, YYYY.

    Any suggestions are much appreciated!!!!

    Last edited by erdubya; Sep 26, 2006, 02:32 AM. Reason: better title
    Elliott
    http://projectvibe.net

  • #2
    Use strtotime() to convert the YYYYMMDD string into a timestamp, then use date() to convert the timestamp into what ever format you want.
    Last edited by PassiveSmoking; Sep 26, 2006, 05:40 AM.

    Comment


    • #3
      if you have the date in a database then extract it from there in the format you want. mysql uses DATE_FORMAT to do so.

      Comment


      • #4
        the php functions substr() mktime() date() may help you
        Free php image upload script
        Personal web developing blog

        Comment


        • #5
          Thanks Guys.

          I was brain dead and couldn't think a whole lot so I ended up with a switch statement on the MM part of the variable...

          01:
          $month = January
          02.... etc...

          I'll give the mysql option a try since it is coming from the database and i could stand to make my code a bit more efficient.
          Elliott
          http://projectvibe.net

          Comment

          Working...
          X