| | |
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 |
# .htaccess 5.2.10 access alexa apache api array beginner broken cakephp checkbox class clean clients cms code convert cron curl database date directory display dissertation dropdown dynamic echo$_get[x]changingitintovariable... email encode error fairness file folder form forms function functions google hack href htaccess html htmlspecialchars image include indentedsubcategory ip javascript joomla legislation limit link local login mail memberships menu methods multiple multipletables mysql mysqlquery network newsletters oop open passwords paypal pdf persist php provider query radio random redirect remote script search secure server sessions simple sockets source space spam sql system table tutorial upload url user variable video voteup web youtube





