com693 Posted November 3, 2007 Posted November 3, 2007 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? Quote
TCH-Bruce Posted November 3, 2007 Posted November 3, 2007 Two good resources for manipulating dates in PHP Date and Timezone Quote
dave_st24 Posted November 7, 2007 Posted November 7, 2007 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 Quote
wkg Posted November 16, 2007 Posted November 16, 2007 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. Quote
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.