willpower Posted August 14, 2007 Share Posted August 14, 2007 I need to determine the current time in hh:mm:ss i have the following <?php ini_set("date.timezone","Europe/London"); $hour=date("G"); $min=date('i'); $secs=date('s'); $newtime=date('H\:i\:s' ,mktime('$hour','$min','$secs',0,0,0)); echo $newtime; ?> But it only returns the hour....what am i doing wrong? Quote Link to comment https://forums.phpfreaks.com/topic/64764-solved-time-mktime/ Share on other sites More sharing options...
uwannadonkey Posted August 14, 2007 Share Posted August 14, 2007 im not a pro, im still learning, but i got a question $hour=date("G"); $min=date('i'); $secs=date('s'); $newtime=date('H\:i\:s' ,mktime('$hour','$min','$secs',0,0,0)); your $hour = date("g"); but it turns into a H? Quote Link to comment https://forums.phpfreaks.com/topic/64764-solved-time-mktime/#findComment-323055 Share on other sites More sharing options...
willpower Posted August 14, 2007 Author Share Posted August 14, 2007 i need to check that but regardless I thought that the formatting was correct and strangley the hours is the bit that works. so 08:14:45 is returned as 08:00:00 Will Quote Link to comment https://forums.phpfreaks.com/topic/64764-solved-time-mktime/#findComment-323057 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.