Jump to content

changing date time to something other than where the server is located


webguync

Recommended Posts

Hello,

 

I am setting a date variable as this

$now = date("F j, Y, g:i a");

 

it displays the time as three hours difference from where I am, so I believe the server must be on west coast time and I am on east coast. I want to set the time three hours ahead. How can this be accomplished?

Link to comment
Share on other sites

a little bit more on this. I need the timestamp to be entered into a field in my MySQL DB when form values are submitted,

 

I have the variable set as

 

$now = date('F j, Y, g:i a', strtotime('+3 hours'));

 

and the SQL is :

 

$insert = "INSERT INTO $check_table (`Assessor`,`AssessorID`,`EmpName`,`EmpID`, `Blocks`,`date_uploaded`) VALUES ('$Assessor','$Assessor_ID','$emp','$emp_id', '$blocks', '$now')";

 

the field column 'date_uploaded' is set as type 'datetime'

 

this worked before I added the strtotime('+3 hours') part. Did I need to make changes anywhere else to get the date to upload properly?

Link to comment
Share on other sites

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.