<?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: MySQL Update Query to Convert Date Formats MM/DD/YYYY to YYYY-MM-DD</title>
	<atom:link href="http://www.timflight.com/mysql-update-query-to-convert-date-formats-mmddyyyy-to-yyyy-mm-dd/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.timflight.com/mysql-update-query-to-convert-date-formats-mmddyyyy-to-yyyy-mm-dd/</link>
	<description></description>
	<pubDate>Tue, 06 Jan 2009 07:07:04 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: robert</title>
		<link>http://www.timflight.com/mysql-update-query-to-convert-date-formats-mmddyyyy-to-yyyy-mm-dd/comment-page-1/#comment-35978</link>
		<dc:creator>robert</dc:creator>
		<pubDate>Thu, 11 Oct 2007 21:41:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.timflight.com/2005/06/30/mysql-update-query-to-convert-date-formats-mmddyyyy-to-yyyy-mm-dd/#comment-35978</guid>
		<description>Thanks to everyone who posed these queries, they were a lifesaver!!!!</description>
		<content:encoded><![CDATA[<p>Thanks to everyone who posed these queries, they were a lifesaver!!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Henny Savenije</title>
		<link>http://www.timflight.com/mysql-update-query-to-convert-date-formats-mmddyyyy-to-yyyy-mm-dd/comment-page-1/#comment-34177</link>
		<dc:creator>Henny Savenije</dc:creator>
		<pubDate>Tue, 18 Sep 2007 06:01:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.timflight.com/2005/06/30/mysql-update-query-to-convert-date-formats-mmddyyyy-to-yyyy-mm-dd/#comment-34177</guid>
		<description>Mark Dyer made this brilliant query and I adjusted it to work

UPDATE tng_people SET birthdatetr=
IF (LOWER(birthdate) regexp
'(jan&#124;feb&#124;mar&#124;apr&#124;may&#124;jun&#124;jul&#124;aug&#124;sep&#124;oct&#124;nov&#124;dec){3} [0-9]{4}$'AND
(birthdatetr = "0000-00-00"), 
    str_to_date(substring_index(birthdate,' ',-3), '%e %b %Y'),
if (LOWER(birthdate) regexp
'(jan&#124;feb&#124;mar&#124;apr&#124;may&#124;jun&#124;jul&#124;aug&#124;sep&#124;oct&#124;nov&#124;dec){3} [0-9]{4}$' AND
(birthdatetr = "0000-00-00"), 
       str_to_date(substring_index(birthdate,' ',-2), '%b %Y'),
              if(LOWER(birthdate regexp '[0-9]{1,2,3,4}$' AND (birthdatetr = "0000-00-00"),
           str_to_date(substring_index(birthdate,' ',-1), '%Y'), 
           birthdatetr
        )
    )
);</description>
		<content:encoded><![CDATA[<p>Mark Dyer made this brilliant query and I adjusted it to work</p>
<p>UPDATE tng_people SET birthdatetr=<br />
IF (LOWER(birthdate) regexp<br />
&#8216;(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec){3} [0-9]{4}$&#8217;AND<br />
(birthdatetr = &#8220;0000-00-00&#8243;),<br />
    str_to_date(substring_index(birthdate,&#8217; &#8216;,-3), &#8216;%e %b %Y&#8217;),<br />
if (LOWER(birthdate) regexp<br />
&#8216;(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec){3} [0-9]{4}$&#8217; AND<br />
(birthdatetr = &#8220;0000-00-00&#8243;),<br />
       str_to_date(substring_index(birthdate,&#8217; &#8216;,-2), &#8216;%b %Y&#8217;),<br />
              if(LOWER(birthdate regexp &#8216;[0-9]{1,2,3,4}$&#8217; AND (birthdatetr = &#8220;0000-00-00&#8243;),<br />
           str_to_date(substring_index(birthdate,&#8217; &#8216;,-1), &#8216;%Y&#8217;),<br />
           birthdatetr<br />
        )<br />
    )<br />
);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: William Keef</title>
		<link>http://www.timflight.com/mysql-update-query-to-convert-date-formats-mmddyyyy-to-yyyy-mm-dd/comment-page-1/#comment-26788</link>
		<dc:creator>William Keef</dc:creator>
		<pubDate>Thu, 31 May 2007 20:48:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.timflight.com/2005/06/30/mysql-update-query-to-convert-date-formats-mmddyyyy-to-yyyy-mm-dd/#comment-26788</guid>
		<description>Here is a MySQL query that will modify the single digit in  DD of MM/DD/YYYY so it has a zero in front of it:

update tablename set datecolumname = replace (datecolumname,'/1/','/01/')
WHERE datecolumname regexp '/[0-9]/';
update tablename set datecolumname = replace (datecolumname,'/2/','/02/')
WHERE datecolumname regexp '/[0-9]/';
update tablename set datecolumname = replace (datecolumname,'/3/','/03/')
WHERE datecolumname regexp '/[0-9]/';
update tablename set datecolumname = replace (datecolumname,'/4/','/04/')
WHERE datecolumname regexp '/[0-9]/';
update tablename set datecolumname = replace (datecolumname,'/5/','/05/')
WHERE datecolumname regexp '/[0-9]/';
update tablename set datecolumname = replace (datecolumname,'/6/','/06/')
WHERE datecolumname regexp '/[0-9]/';
update tablename set datecolumname = replace (datecolumname,'/7/','/07/')
WHERE datecolumname regexp '/[0-9]/';
update tablename set datecolumname = replace (datecolumname,'/8/','/08/')
WHERE datecolumname regexp '/[0-9]/';
update tablename set datecolumname = replace (datecolumname,'/9/','/09/')
WHERE datecolumname regexp '/[0-9]/'

This MySQL query will add a zero to the MM portion of MM/DD/YYYY : 

update AK2KOrderDetails set ShipDateOD = CONCAT((REPLACE("", "",ShipDateOD)), "0", ShipDateOD )
WHERE ShipDateOD NOT LIKE '10%' AND ShipDateOD NOT LIKE '11%' AND ShipDateOD NOT LIKE '12%'

Thanks for the conversion query you provided which does the rest. From a fellow pilot who spent my summers at my parents house on Eustis Ridge. Lots of relatives I have from the Srtatton area. Love Bigelow range.</description>
		<content:encoded><![CDATA[<p>Here is a MySQL query that will modify the single digit in  DD of MM/DD/YYYY so it has a zero in front of it:</p>
<p>update tablename set datecolumname = replace (datecolumname,&#8217;/1/&#8217;,'/01/&#8217;)<br />
WHERE datecolumname regexp &#8216;/[0-9]/&#8217;;<br />
update tablename set datecolumname = replace (datecolumname,&#8217;/2/&#8217;,'/02/&#8217;)<br />
WHERE datecolumname regexp &#8216;/[0-9]/&#8217;;<br />
update tablename set datecolumname = replace (datecolumname,&#8217;/3/&#8217;,'/03/&#8217;)<br />
WHERE datecolumname regexp &#8216;/[0-9]/&#8217;;<br />
update tablename set datecolumname = replace (datecolumname,&#8217;/4/&#8217;,'/04/&#8217;)<br />
WHERE datecolumname regexp &#8216;/[0-9]/&#8217;;<br />
update tablename set datecolumname = replace (datecolumname,&#8217;/5/&#8217;,'/05/&#8217;)<br />
WHERE datecolumname regexp &#8216;/[0-9]/&#8217;;<br />
update tablename set datecolumname = replace (datecolumname,&#8217;/6/&#8217;,'/06/&#8217;)<br />
WHERE datecolumname regexp &#8216;/[0-9]/&#8217;;<br />
update tablename set datecolumname = replace (datecolumname,&#8217;/7/&#8217;,'/07/&#8217;)<br />
WHERE datecolumname regexp &#8216;/[0-9]/&#8217;;<br />
update tablename set datecolumname = replace (datecolumname,&#8217;/8/&#8217;,'/08/&#8217;)<br />
WHERE datecolumname regexp &#8216;/[0-9]/&#8217;;<br />
update tablename set datecolumname = replace (datecolumname,&#8217;/9/&#8217;,'/09/&#8217;)<br />
WHERE datecolumname regexp &#8216;/[0-9]/&#8217;</p>
<p>This MySQL query will add a zero to the MM portion of MM/DD/YYYY : </p>
<p>update AK2KOrderDetails set ShipDateOD = CONCAT((REPLACE(&#8221;", &#8220;&#8221;,ShipDateOD)), &#8220;0&#8243;, ShipDateOD )<br />
WHERE ShipDateOD NOT LIKE &#8216;10%&#8217; AND ShipDateOD NOT LIKE &#8216;11%&#8217; AND ShipDateOD NOT LIKE &#8216;12%&#8217;</p>
<p>Thanks for the conversion query you provided which does the rest. From a fellow pilot who spent my summers at my parents house on Eustis Ridge. Lots of relatives I have from the Srtatton area. Love Bigelow range.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim Flight</title>
		<link>http://www.timflight.com/mysql-update-query-to-convert-date-formats-mmddyyyy-to-yyyy-mm-dd/comment-page-1/#comment-815</link>
		<dc:creator>Tim Flight</dc:creator>
		<pubDate>Tue, 28 Feb 2006 19:08:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.timflight.com/2005/06/30/mysql-update-query-to-convert-date-formats-mmddyyyy-to-yyyy-mm-dd/#comment-815</guid>
		<description>No, it doesn't. It also assumes the date is formatted with slashes.

In my case I already had leading zeroes for both the date and month sections of the field so I didn't have to worry about it. It could certainly be done with PHP (or any other favorite scripting language) by finding where in the string the slash separators are, then parsing the values between to accommodate for months and dates with or without leading zeros. Then you could also add in the ability to deal with two or four digit years, etc.</description>
		<content:encoded><![CDATA[<p>No, it doesn&#8217;t. It also assumes the date is formatted with slashes.</p>
<p>In my case I already had leading zeroes for both the date and month sections of the field so I didn&#8217;t have to worry about it. It could certainly be done with PHP (or any other favorite scripting language) by finding where in the string the slash separators are, then parsing the values between to accommodate for months and dates with or without leading zeros. Then you could also add in the ability to deal with two or four digit years, etc.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: michael salmons</title>
		<link>http://www.timflight.com/mysql-update-query-to-convert-date-formats-mmddyyyy-to-yyyy-mm-dd/comment-page-1/#comment-814</link>
		<dc:creator>michael salmons</dc:creator>
		<pubDate>Tue, 28 Feb 2006 18:57:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.timflight.com/2005/06/30/mysql-update-query-to-convert-date-formats-mmddyyyy-to-yyyy-mm-dd/#comment-814</guid>
		<description>This is nice but doesn't take into account months that might only have one number and dates that might have two. Too bad, I've really been digging hard for a way to do this.</description>
		<content:encoded><![CDATA[<p>This is nice but doesn&#8217;t take into account months that might only have one number and dates that might have two. Too bad, I&#8217;ve really been digging hard for a way to do this.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
