Jump to content

Recommended Posts

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

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.