Jump to content

Mysql Timestamp


Recommended Posts

I have a column in a table in a database set as type "timestamp".

 

I'm tinkering with PHP and Dreamweaver CS3 for the first time and learning a lot by figuring out. I have a form that is inserting a record into the mysql database, and while it does stamp the "timestamp" column, it's stamping two hours ahead (for the mysql server system time, I suppose).

 

Is there a way to adjust this within phpMyAdmin or somewhere else?

Link to post
Share on other sites

I tend to create my own functions in a file that is available to all pages, something like

 

Function MyDate() { // Creates a timestamp for a UK website on a TCH server

Return date("YmdHis", strtotime("+5 hours"));

}

 

Dates are shown as 200711070900 (6th Nov 2007 9:00 am)

 

Then when I want to display my date I use another function like

 

Function ShowDate($ThisDate) {

Return date("l jS F Y", strtotime($ThisDate));

}

 

$Date = MyDate(); // returns 200711070900

 

echo ShowDate($Date); // Prints Wednesday 7th November 2007

Link to post
Share on other sites
  • 2 weeks later...
I tend to create my own functions in a file that is available to all pages,

 

Since you are creating your own functions, you can do what I've done... simply subtract (or add) a constant to the the server time. In my case I simply subtract 2 from the hours to get my local time. Not very elegant, but it works.

Link to post
Share on other sites

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.   Paste as plain text instead

  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...