affordit Posted April 24, 2008 Share Posted April 24, 2008 Can someone tell me how too display the current time on a page?, all I get is the unix stamp don't know how to convert it. Link to comment https://forums.phpfreaks.com/topic/102779-timestamp-question/ Share on other sites More sharing options...
jonsjava Posted April 24, 2008 Share Posted April 24, 2008 <?php $day = date("d"); $month = date("F"); $suffix = date("S"); $year = date("Y"); $date = $month." ".$day."<sup>".$suffix."</sup>, ".$year; print $date; Link to comment https://forums.phpfreaks.com/topic/102779-timestamp-question/#findComment-526457 Share on other sites More sharing options...
rhodesa Posted April 24, 2008 Share Posted April 24, 2008 http://www.php.net/date has all the info for how to format a date Link to comment https://forums.phpfreaks.com/topic/102779-timestamp-question/#findComment-526460 Share on other sites More sharing options...
DeanWhitehouse Posted April 24, 2008 Share Posted April 24, 2008 how can i set time zones , if the timezone name is in the database? Link to comment https://forums.phpfreaks.com/topic/102779-timestamp-question/#findComment-526468 Share on other sites More sharing options...
rhodesa Posted April 24, 2008 Share Posted April 24, 2008 http://us2.php.net/manual/en/function.date-default-timezone-set.php Link to comment https://forums.phpfreaks.com/topic/102779-timestamp-question/#findComment-526471 Share on other sites More sharing options...
jonsjava Posted April 24, 2008 Share Posted April 24, 2008 example for setting time zone: date("O") = your time zone. sorry, wrote that wrong last time. from there, it's simply math. Link to comment https://forums.phpfreaks.com/topic/102779-timestamp-question/#findComment-526472 Share on other sites More sharing options...
affordit Posted April 24, 2008 Author Share Posted April 24, 2008 OK I got this far but this gives me the time 7 hours ahead of me, how do I chage it to get my time zone? echo date('l jS \of F Y h:i:s A'); Link to comment https://forums.phpfreaks.com/topic/102779-timestamp-question/#findComment-526541 Share on other sites More sharing options...
rhodesa Posted April 24, 2008 Share Posted April 24, 2008 What timezone are you in? <?php date_default_timezone_set('America/Los_Angeles'); echo date('l jS \of F Y h:i:s A'); ?> More timezones: http://us3.php.net/manual/en/timezones.php Link to comment https://forums.phpfreaks.com/topic/102779-timestamp-question/#findComment-526549 Share on other sites More sharing options...
affordit Posted April 24, 2008 Author Share Posted April 24, 2008 Pacific, Oregon Link to comment https://forums.phpfreaks.com/topic/102779-timestamp-question/#findComment-526550 Share on other sites More sharing options...
affordit Posted April 24, 2008 Author Share Posted April 24, 2008 This code displays nothing? , anyone know whats wrong? <?php date_default_timezone_set('America/Los_Angeles'); echo date('l jS \of F Y h:i:s A'); ?> Link to comment https://forums.phpfreaks.com/topic/102779-timestamp-question/#findComment-526580 Share on other sites More sharing options...
rhodesa Posted April 24, 2008 Share Posted April 24, 2008 for me it displays: Thursday 24th of April 2008 03:30:02 PM Are you using PHP5+? date_default_timezone_set() is a PHP5 function. If you are using PHP4 (which is a pretty old version), try following this tutorial: http://drakecms.sourceforge.net/index.php?option=content&id=32&Itemid=10 Link to comment https://forums.phpfreaks.com/topic/102779-timestamp-question/#findComment-526597 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.