Date/Time in PHP


<?php
// Server is Central Standard Time
$today = date("D g:i A");
echo $today;
echo ' (CST)';
?>

Example output
Sun 6:09 AM (CST)

To add/subtract hours

<?php
// Return date/time info of a timestamp; then format the output
$today = date("D g:i A");
$convertedTime = date('D g:i A',strtotime('-2 hour',strtotime($today)));
echo $convertedTime;
echo ' (PST)';
?>

Leave a Reply

Your email address will not be published. Required fields are marked *

Shares