| | |
24 Hours to 12 Hours in PHP
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
How we can use current time instead of '15:33:56'
now() Function or time() but it gives wrong time in AM and PM. php Syntax (Toggle Plain Text)
<?php function twentyfourToTwelve($time) { return date('g:i:sa', strtotime($time)); } /*** Example usage ***/ echo twentyfourToTwelve('15:33:56').'<br />'; echo twentyfourToTwelve('15:33').'<br />'; echo twentyfourToTwelve('15.12').'<br />'; echo twentyfourToTwelve('2:33:56').'<br />'; echo twentyfourToTwelve('15:33').'<br />'; ?>
Ayesha
PHP Syntax (Toggle Plain Text)
function twentyfourToTwelve($time) { return date('g:i:s a', strtotime($time . " UTC")); } /*** Example usage ***/ echo twentyfourToTwelve('15:33:56');
This work?
Happy Humbugging Christmas
![]() |
Similar Threads
- convert seconds to minutes, hours, days, months, years, etc. (C)
- Basic PHP Includes (PHP)
- Cannot get MySQL to talk to .php file (MySQL)
- plz can someone help me?? code for employee's hours worked (C++)
- learning php (PHP)
- get html element value using php (PHP)
- Please help me out, I realy need help in the next 4 hours (C++)
- PHP 5 - Over before it began (PHP)
Other Threads in the PHP Forum
- Previous Thread: table & column= variable
- Next Thread: Problem in Wamp server!
| Thread Tools | Search this Thread |
.htaccess ajax alerts apache api array autocomplete beginner binary broken cakephp checkbox class cms code convert cron curl database date display dynamic echo email emptydisplayvalue error errors file files folder form forms function functions google hack href htaccess html htmlspecialchars image include insert integration ip java javascript joomla limit link login loop mail menu methods mlm mod_rewrite multiple mysql network object oop paypal pdf php problem query radio random recursion recursive redirect regex remote script search securephp server sessions shot sms soap source space sql subscription syntax system table tutorial update upload url validation validator variable video web xml youtube






