| | |
Time Stamp Help
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
Use the date() function: http://php.net/date
php Syntax (Toggle Plain Text)
$time = time(); $date = date('d-m-L H:i:s' , $time); echo $date; // 03-05-2008 18:05:44
Here,I made a function just for you using explode function:
Enjoy!!!
php Syntax (Toggle Plain Text)
//$var is your timestamp... function x($var) { list($date,$time)=explode(" ", $var); list($year,$month,$day)=explode("-",$date); $newdate=$month."-".$day."-".$year." ".$time; return $newdate; }
Enjoy!!!
php Syntax (Toggle Plain Text)
<?php //old time $old_time = '2008-03-05 18:05:44'; //convert to UNIX timestamp $timestamp = strtotime($old_time); //fetch new format $new_time = date('m-d-Y H:i:s' , $timestamp); //output new time echo $new_time; ?>
The End
•
•
•
•
Use the date() function: http://php.net/date
php Syntax (Toggle Plain Text)
$time = time(); $date = date('d-m-L H:i:s' , $time); echo $date; // 03-05-2008 18:05:44
The End
![]() |
Similar Threads
- I just need TIME not Date. (MS SQL)
- date and time in file name (VB.NET)
- Convert time stamp to date using php (PHP)
- File with date + time (Python)
- Perl- How to call an event after a time delay (Perl)
- Need real time in XP (Visual Basic 4 / 5 / 6)
- Recording time stamp (PHP)
- help with clean win2000 install (Windows NT / 2000 / XP)
Other Threads in the PHP Forum
- Previous Thread: Choosing Symfony , Zend Framework, CakePHP
- Next Thread: PHPEclipse installation
| Thread Tools | Search this Thread |
apache api array beginner binary body broken buttons cakephp checkbox class cms code cron curl database date date/time display dynamic ebooks echo email error file files folder form forms function functions global google href htaccess html image include insert ip javascript joomla limit link list login mail mediawiki menu mlm msqli_multi_query multiple mycodeisbad mysql number oop parameter paypal pdf php phpincludeissue problem query radio random recourse recursion regex remote script search seo server sessions sms source sp space speed sql static subdomain syntax system table tag tutorial update upload url validator variable vbulletin video web webdesign white wordpress xml youtube





