Project / Support Center
Welcome, Guest. Please login or register. May 13, 2021, 10:22: PM
Home Help Search Login Register
D-Web Web Site Creator D - Web Web Site Creator On-line HTML Editor No Programming knowledge required. Web Global Net PayPal-Cart Shopping Cart System PayPal - Kart Shopping Cart System for E-Commerce over the internet, that's easy to use. Web Global Net Newsletter Manager Newsletter Manager On-line Newsletter Creator with Email Subscriber Management.
Ring Central Discount
Web Global Net Web Application & Web Development Project Center  |  Technical Issues  |  php related  |  Topic: php dirty way to insert local time if wrong 0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Go Down Send this topic Print
Author Topic: php dirty way to insert local time if wrong  (Read 588 times)
admin
Administrator
******
Offline Offline

Posts: 220


« on: 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
« Last Edit: November 24, 2020, 08:53: PM by admin » Report to moderator   Logged

The Unknown Webmaster
Pages: [1] Go Up Send this topic Print 
Web Global Net Web Application & Web Development Project Center  |  Technical Issues  |  php related  |  Topic: php dirty way to insert local time if wrong « previous next »
Jump to:  


Login with username, password and session length
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!