Mysql Timestamp

liunx

Guest
I have a column in a table in a database set as type "timestamp".<br /><br />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).<br /><br />Is there a way to adjust this within phpMyAdmin or somewhere else?<!--content-->
Two good resources for manipulating dates in PHP<br /><br /><a href="http://us.php.net/date" target="_blank">Date</a> and <a href="http://www.expertsrt.com/tutorials/Matt/PHPTimeZone.html" target="_blank">Timezone</a><!--content-->
I tend to create my own functions in a file that is available to all pages, something like <br /><br />Function MyDate() { // Creates a timestamp for a UK website on a TCH server<br /> Return date("YmdHis", strtotime("+5 hours"));<br />}<br /><br />Dates are shown as 200711070900 (6th Nov 2007 9:00 am)<br /><br />Then when I want to display my date I use another function like<br /><br />Function ShowDate($ThisDate) {<br /> Return date("l jS F Y", strtotime($ThisDate));<br />}<br /><br />$Date = MyDate(); // returns 200711070900<br /><br />echo ShowDate($Date); // Prints Wednesday 7th November 2007<br /><!--content-->
<!--quoteo(post=215816:date=Nov 7 2007, 02:23 AM:name=dave_st24)--><div class='quotetop'>QUOTE (dave_st24 @ Nov 7 2007, 02:23 AM) <a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=215816"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><div class='quotemain'><!--quotec-->I tend to create my own functions in a file that is available to all pages,<!--QuoteEnd--></div><!--QuoteEEnd--><br /><br />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.<!--content-->
 
Back
Top