Jump to content

date conversion


Deoctor

Recommended Posts

Need more information.

How/where do you get the date? What are you using it for.

Look at the php manual for date strings: http://php.net/manual/en/function.date.php

 

Also found this Googling php date format:

<?PHP
if (!function_exists('convertTime')) {
  /** Converts time strings from one format into another using
   *  PHP formats.
   *
   *  @param String $dformat Format to convert to
   *  @param String $sformat Format to convert from, e.g. format
   *      of $ts
   *  @param String $ts Time string to be converted
   *  @return String Supplied time translated to the format specified
   *    in $dformat
   */
  function convertTime($dformat,$sformat,$ts) {
    extract(strptime($ts,$sformat));
    return strftime($dformat,mktime(
                                  intval($tm_hour),
                                  intval($tm_min),
                                  intval($tm_sec),
                                  intval($tm_mon)+1,
                                  intval($tm_mday),
                                  intval($tm_year)+1900
                                ));
  }
}

/*
* And for the test....
*/
echo convertTime('%Y-%m-%d','%d.%m.%Y','27.11.2009');
?>

This should print "2009-27-11".

 

Hope this helps.

Link to comment
Share on other sites

Dear Irvon

ur function does not work..

as strptime is not a valid php function.

and for the info u require i am getting the date value as like this..

date('l jS \of F Y h:i:s A')

 

i have checked the php manual but didnt found any solution for my issue. :'(

 

Can some one help me out on this.. :wtf:

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.