Project / Support Center
Welcome, %1$s. Please login or register. February 28, 2024, 09:43: AM
Web Global Net Web Application & Web Development Project Center  |  Technical Issues  |  php related  |  : php dirty way to insert local time if wrong 0 and 1 Guest are viewing this topic. « previous next »
: [1]
: php dirty way to insert local time if wrong  ( 4061 )
admin
Administrator
******


: 239


« : November 24, 2020, 08:48: PM »

my server was 5 hours ahead and I needed to store the fixed local time ( meaning no other time zones would be needed)

<?php $hour= date('g'); ?>

<?php $time= $hour-5 ?>

Bold is the hour - $time takes the hour and subtracts 5 hours - change this to what ever you need to to match your correct time.

this is the value used in a text field

 value="<?php echo date('F') ?> <?php echo date('d') ?> <?php echo date('Y') ?>  - <?php echo $time ?>:<?php echo date('i') ?> <?php echo date('a') ?>"


This will insert into a text field in this format (we use this to show when someone last updated a record).

November 24, 2020 - 3:24 pm
« : November 24, 2020, 08:53: PM admin »  

The Unknown Webmaster
: [1]  
Web Global Net Web Application & Web Development Project Center  |  Technical Issues  |  php related  |  : php dirty way to insert local time if wrong « previous next »
:  


Powered by MySQL Powered by PHP Valid XHTML 1.0! Valid CSS!
Sorry, the copyright must be in the template.
Please notify this forum's administrator that this site is missing the copyright message for SMF so they can rectify the situation. Display of copyright is a legal requirement. For more information on this please visit the Simple Machines website.