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
https://forums.phpfreaks.com/topic/191015-date-conversion/#findComment-1007263
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
https://forums.phpfreaks.com/topic/191015-date-conversion/#findComment-1007271
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.