damien275x Posted April 29, 2012 Share Posted April 29, 2012 Hello PHP Freaks, I am using a basic payment frame system, and it requires me to pass in a GMT time in this format, in a hidden form. "YYYYMMDDHHMMSS" I have found a lot of examples in PHP on how to format the above tag, but what would be the easiest way to generate it as is? To make things a little more complicated, there are different users in different GMT times, and based on the state they select it needs to + or - hours from the current time to get the GMT time. The formulas to calculate the results are as follows, just after the best approach in PHP to calculate: State #1: CURRENT_TIME + 10 HOURS = GMT TIME (echo as YYYYMMDDHHMMSS) and assign to $GMT_TIMESTAMP State #2: CURRENT TIME + 9.5 HOURS = GMT TIME (echo as YYYYMMDDHHMMSS) and assign to $GMT_TIMESTAMP What would be the best way to tackle this ? At the moment I have select boxes where the user can pick the state, then click SUBMIT. Thankyou in advance, D Quote Link to comment https://forums.phpfreaks.com/topic/261793-use-php-to-echo-yyyymmddhhmmss-and-gmt-times/ Share on other sites More sharing options...
requinix Posted April 29, 2012 Share Posted April 29, 2012 The time is calculated according to your server. Not according to where the user is. The only way it would be like that is if your code specifically altered the timezone PHP was using to calculate dates. gmdate("YmdHis") for starters, making sure that the timezone is the server's timezone and not the user's. Quote Link to comment https://forums.phpfreaks.com/topic/261793-use-php-to-echo-yyyymmddhhmmss-and-gmt-times/#findComment-1341511 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.