<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How to create a TIMESTAMP/DATETIME column in MySQL to automatically be set with the current time</title>
	<atom:link href="http://www.kbedell.com/2009/03/07/how-to-create-a-timestampdatetime-column-in-mysql-to-automatically-be-set-with-the-current-time/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kbedell.com/2009/03/07/how-to-create-a-timestampdatetime-column-in-mysql-to-automatically-be-set-with-the-current-time/</link>
	<description>Discussions on Ruby on Rails, the MySQL database, Social Media, Twitter, Wordpress and other tech issues</description>
	<lastBuildDate>Fri, 09 Jul 2010 12:53:38 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: davidnewcomb</title>
		<link>http://www.kbedell.com/2009/03/07/how-to-create-a-timestampdatetime-column-in-mysql-to-automatically-be-set-with-the-current-time/comment-page-1/#comment-107</link>
		<dc:creator>davidnewcomb</dc:creator>
		<pubDate>Wed, 12 Aug 2009 14:45:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.kbedell.com/?p=135#comment-107</guid>
		<description>&quot;Note that only one of the fields can be TIMESTAMP, that’s a limitation of MySQL.&quot;

This is not true. You can have as many TIMESTAMP columns as you like in a table. The only limitation is that the first TIMESTAMP column in the table is updated when the record is updated and the other TIMESTAMP columns are not.&lt;p class=&quot;top-comments&quot;&gt;Current score: &lt;span class=&quot;top-comments-karma&quot; id=&quot;karma-107&quot;&gt;0&lt;/span&gt; &lt;small&gt;(to vote for this comment, please visit the site)&lt;/small&gt;&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>&#8220;Note that only one of the fields can be TIMESTAMP, that’s a limitation of MySQL.&#8221;</p>
<p>This is not true. You can have as many TIMESTAMP columns as you like in a table. The only limitation is that the first TIMESTAMP column in the table is updated when the record is updated and the other TIMESTAMP columns are not.
<p class="top-comments">Current score: <span class="top-comments-karma" id="karma-107">0</span> <small>(to vote for this comment, please visit the site)</small></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: FroDo</title>
		<link>http://www.kbedell.com/2009/03/07/how-to-create-a-timestampdatetime-column-in-mysql-to-automatically-be-set-with-the-current-time/comment-page-1/#comment-106</link>
		<dc:creator>FroDo</dc:creator>
		<pubDate>Tue, 04 Aug 2009 09:03:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.kbedell.com/?p=135#comment-106</guid>
		<description>@Diamas: You are perfectly right - I think the fact that the data in a timestamp row is stored in UTC is a even more more important feature of this data type than the auto update function!&lt;p class=&quot;top-comments&quot;&gt;Current score: &lt;span class=&quot;top-comments-karma&quot; id=&quot;karma-106&quot;&gt;0&lt;/span&gt; &lt;small&gt;(to vote for this comment, please visit the site)&lt;/small&gt;&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>@Diamas: You are perfectly right &#8211; I think the fact that the data in a timestamp row is stored in UTC is a even more more important feature of this data type than the auto update function!
<p class="top-comments">Current score: <span class="top-comments-karma" id="karma-106">0</span> <small>(to vote for this comment, please visit the site)</small></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dimas</title>
		<link>http://www.kbedell.com/2009/03/07/how-to-create-a-timestampdatetime-column-in-mysql-to-automatically-be-set-with-the-current-time/comment-page-1/#comment-104</link>
		<dc:creator>Dimas</dc:creator>
		<pubDate>Mon, 13 Jul 2009 20:52:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.kbedell.com/?p=135#comment-104</guid>
		<description>My initial thinking was along the same lines as yours: having a single timestamp value and the others as datetime. My thinking has since changed to having all datetime values as TIMESTAMP fields because: depending on your development environments it will not always be guaranteed that the timezone values set for deployment servers will be similar, equally the changing of timezone values can screw up the datetime inputs into your tables.

Saving as DATETIME means that you are saving the datetime value in the current operating timezone. 

Saving as TIMESTAMP means that MySQL will convert the datetime from the operating timezone into UTC (Unix Time) and store it, then convert it back to the operating timezone on retrieval. Using TIMESTAMP fields makes avoids confusion and allows you to accurately display with out the worrying which timezone the datetime is stored as in the database.&lt;p class=&quot;top-comments&quot;&gt;Current score: &lt;span class=&quot;top-comments-karma&quot; id=&quot;karma-104&quot;&gt;0&lt;/span&gt; &lt;small&gt;(to vote for this comment, please visit the site)&lt;/small&gt;&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>My initial thinking was along the same lines as yours: having a single timestamp value and the others as datetime. My thinking has since changed to having all datetime values as TIMESTAMP fields because: depending on your development environments it will not always be guaranteed that the timezone values set for deployment servers will be similar, equally the changing of timezone values can screw up the datetime inputs into your tables.</p>
<p>Saving as DATETIME means that you are saving the datetime value in the current operating timezone. </p>
<p>Saving as TIMESTAMP means that MySQL will convert the datetime from the operating timezone into UTC (Unix Time) and store it, then convert it back to the operating timezone on retrieval. Using TIMESTAMP fields makes avoids confusion and allows you to accurately display with out the worrying which timezone the datetime is stored as in the database.
<p class="top-comments">Current score: <span class="top-comments-karma" id="karma-104">0</span> <small>(to vote for this comment, please visit the site)</small></p>
]]></content:encoded>
	</item>
</channel>
</rss>
