converting date format

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gubbachchi
    New Member
    • Jan 2008
    • 59

    #1

    converting date format

    Hi,

    I have an issue regarding the php date format. I choose the date from date-picker which is in the format date('Y-m-d') i.e. 2008-09-12, then I will store this date in the variable $date_id and send this date to different php pages and I need to print the date from $date_id variable in the format date('d F Y') i.e. 12 september 2008. How can I do this using php date functions

    WIth regards
  • hsriat
    Recognized Expert Top Contributor
    • Jan 2008
    • 1653

    #2
    Originally posted by gubbachchi
    Hi,

    I have an issue regarding the php date format. I choose the date from date-picker which is in the format date('Y-m-d') i.e. 2008-09-12, then I will store this date in the variable $date_id and send this date to different php pages and I need to print the date from $date_id variable in the format date('d F Y') i.e. 12 september 2008. How can I do this using php date functions

    WIth regards
    Use gmmktime() to convert your time to Unix time stamp format.

    See this tutorial.

    Comment

    • ronverdonk
      Recognized Expert Specialist
      • Jul 2006
      • 4259

      #3
      This will do it [php]<?php
      $date_id='2008-09-12';
      echo date('d F Y', strtotime($date _id));
      ?>[/php]result
      Code:
      12 September 2008
      Ronald

      Comment

      • gubbachchi
        New Member
        • Jan 2008
        • 59

        #4
        Thank you ronverdonk for your help,
        It is working

        Comment

        • ronverdonk
          Recognized Expert Specialist
          • Jul 2006
          • 4259

          #5
          Glad it worked. See you again in the forum.

          Ronald

          Comment

          Working...