Saturday, August 18, 2012

How To Adjust Php Time


How to adjust PHP time for timezones?
by michaelnaeseth

I have a script that stores user-entered info into a database. When the database entry is added, Im using php date("g:i A"); to display the time of the database entry. However, when this time is entered, it comes up one hour ahead of my time. How do I correct this?



Answer(s):

Answer by rbjolly

// *** Compute the current timestamp.
$ ts = time();

// *** The time as seen by the server:
$ serverTime = date("g:i A", $ ts);

// *** Subtract one hour from timestamp.
$ tsMinusOne = $ ts - (60 * 60);

// *** The time as you see it:
$ yourTime = date("g:i A", $ tsMinusOne);

echo("

Server Time = $ serverTime");
echo("

Your Time =$ yourTime");

?>



Fb Lead Gen: Email Subscribers With A Single Facebook Button

Fbleadgen Is A PHP Script That Allows You To Replace The Email Opt-in Forms On Your Website With A Single Facebook Connect Button. When You Get A Subscriber, Your Aweber/mailchimp Subscription Lists Are Automatically Updated In Real-time!



Three Pillars Customer Support Help Desk Software

Brand New PHP Web Based Customer Support, Help Desk And Ticket System. Takes Minutes To Install And Will Save Hours Of Time A Day. Every Professional Online Marketer Needs One Of These! Have Multiple Admins With Differing Levels Of Access And Authority.


No comments:

Post a Comment