<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://sqlzoo.net/w/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://sqlzoo.net/w/index.php?title=Format_dates&amp;feed=atom&amp;action=history</id>
		<title>Format dates - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://sqlzoo.net/w/index.php?title=Format_dates&amp;feed=atom&amp;action=history"/>
		<link rel="alternate" type="text/html" href="http://sqlzoo.net/w/index.php?title=Format_dates&amp;action=history"/>
		<updated>2013-05-24T09:04:50Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.20.4</generator>

	<entry>
		<id>http://sqlzoo.net/w/index.php?title=Format_dates&amp;diff=1543&amp;oldid=prev</id>
		<title>Connor at 15:15, 17 July 2012</title>
		<link rel="alternate" type="text/html" href="http://sqlzoo.net/w/index.php?title=Format_dates&amp;diff=1543&amp;oldid=prev"/>
				<updated>2012-07-17T15:15:46Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 15:15, 17 July 2012&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 36:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 36:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; WHERE singer='Tom Jones'&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; WHERE singer='Tom Jones'&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;source lang='sql' class='def e-oracle'&amp;gt;SELECT TO_CHAR(wk, 'DD/MM/YYYY'), song&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;source lang='sql' class='def e-oracle'&amp;gt;SELECT TO_CHAR(wk, 'DD/MM/YYYY'), song&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;FROM totp&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;FROM &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;gisq.&lt;/ins&gt;totp&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;WHERE singer='Tom Jones'&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;WHERE singer='Tom Jones'&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;source lang='sql' class='def e-sqlserver'&amp;gt;SELECT CONVERT(VARCHAR(10), wk, 103), song&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;source lang='sql' class='def e-sqlserver'&amp;gt;SELECT CONVERT(VARCHAR(10), wk, 103), song&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Connor</name></author>	</entry>

	<entry>
		<id>http://sqlzoo.net/w/index.php?title=Format_dates&amp;diff=1542&amp;oldid=prev</id>
		<title>Connor: Created page with &quot;Format a date and time. &lt;div class='ht'&gt; &lt;div class=params&gt;schema:gisq&lt;/div&gt; &lt;div&gt; Many engines support the SQL standard - see Mimer for details. &lt;/div&gt; &lt;source lang=sql class...&quot;</title>
		<link rel="alternate" type="text/html" href="http://sqlzoo.net/w/index.php?title=Format_dates&amp;diff=1542&amp;oldid=prev"/>
				<updated>2012-07-17T15:15:18Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;Format a date and time. &amp;lt;div class=&amp;#039;ht&amp;#039;&amp;gt; &amp;lt;div class=params&amp;gt;schema:gisq&amp;lt;/div&amp;gt; &amp;lt;div&amp;gt; Many engines support the SQL standard - see Mimer for details. &amp;lt;/div&amp;gt; &amp;lt;source lang=sql class...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Format a date and time.&lt;br /&gt;
&amp;lt;div class='ht'&amp;gt;&lt;br /&gt;
&amp;lt;div class=params&amp;gt;schema:gisq&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div&amp;gt;&lt;br /&gt;
Many engines support the SQL standard - see Mimer for details.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;source lang=sql class='tidy'&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=sql class='setup'&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang='sql' class='def e-sqlite'&amp;gt;SELECT STRFTIME('%d/%m/%Y', wk), song&lt;br /&gt;
 FROM totp&lt;br /&gt;
 WHERE singer='Tom Jones'&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang='sql' class='def e-db2'&amp;gt;SELECT CHAR(wk, eur),&lt;br /&gt;
       song&lt;br /&gt;
 FROM totp&lt;br /&gt;
 WHERE singer='Tom Jones'&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang='sql' class='def e-ingres'&amp;gt;SELECT CAST(EXTRACT(DAY FROM wk) AS VARCHAR(2))&lt;br /&gt;
       || '/' ||&lt;br /&gt;
       CAST(EXTRACT(MONTH FROM wk) AS VARCHAR(2))&lt;br /&gt;
       || '/' ||&lt;br /&gt;
       CAST(EXTRACT(YEAR FROM wk) AS VARCHAR(4)),&lt;br /&gt;
       song&lt;br /&gt;
 FROM totp&lt;br /&gt;
 WHERE singer='Tom Jones'&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang='sql' class='def e-access'&amp;gt;SELECT FORMAT(wk, 'DD/MM/YYYY'),&lt;br /&gt;
       song&lt;br /&gt;
 FROM totp&lt;br /&gt;
 WHERE singer='Tom Jones'&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang='sql' class='def e-postgres'&amp;gt;SELECT CAST(EXTRACT(DAY FROM wk) AS VARCHAR(2))&lt;br /&gt;
       || '/' ||&lt;br /&gt;
       CAST(EXTRACT(MONTH FROM wk) AS VARCHAR(2))&lt;br /&gt;
       || '/' ||&lt;br /&gt;
       CAST(EXTRACT(YEAR FROM wk) AS VARCHAR(4)),&lt;br /&gt;
       song&lt;br /&gt;
 FROM totp&lt;br /&gt;
 WHERE singer='Tom Jones'&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang='sql' class='def e-oracle'&amp;gt;SELECT TO_CHAR(wk, 'DD/MM/YYYY'), song&lt;br /&gt;
FROM totp&lt;br /&gt;
WHERE singer='Tom Jones'&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang='sql' class='def e-sqlserver'&amp;gt;SELECT CONVERT(VARCHAR(10), wk, 103), song&lt;br /&gt;
  FROM totp&lt;br /&gt;
 WHERE singer='Tom Jones'&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang='sql' class='def e-mysql'&amp;gt;SELECT DATE_FORMAT(wk,'%d/%m/%Y'), song&lt;br /&gt;
FROM totp&lt;br /&gt;
WHERE singer='Tom Jones'&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang='sql' class='def e-mimer'&amp;gt;SELECT CAST(EXTRACT(DAY FROM wk) AS VARCHAR(2))&lt;br /&gt;
       || '/' ||&lt;br /&gt;
       CAST(EXTRACT(MONTH FROM wk) AS VARCHAR(2))&lt;br /&gt;
       || '/' ||&lt;br /&gt;
       CAST(EXTRACT(YEAR FROM wk) AS VARCHAR(4)),&lt;br /&gt;
       song&lt;br /&gt;
 FROM totp&lt;br /&gt;
 WHERE singer='Tom Jones'&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang='sql' class='def e-sybase'&amp;gt;SELECT CAST(EXTRACT(DAY FROM wk) AS VARCHAR(2))&lt;br /&gt;
       || '/' ||&lt;br /&gt;
       CAST(EXTRACT(MONTH FROM wk) AS VARCHAR(2))&lt;br /&gt;
       || '/' ||&lt;br /&gt;
       CAST(EXTRACT(YEAR FROM wk) AS VARCHAR(4)),&lt;br /&gt;
       song&lt;br /&gt;
 FROM totp&lt;br /&gt;
 WHERE singer='Tom Jones'&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;ecomm e-db2&amp;quot; style=&amp;quot;display: none&amp;quot;&amp;gt;The [[TO_CHAR(dates) |CHAR]] function will convert to any of the following formats: ISO, USA, EUR, JIS, and LOCAL&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;ecomm e-access&amp;quot; style=&amp;quot;display: none&amp;quot;&amp;gt;Use the FORMAT function &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;ecomm e-mimer&amp;quot; style=&amp;quot;display: none&amp;quot;&amp;gt;Create a string representing a date to a particular format The Standard provides us with the EXTRACT function that can be used however many engines provide a more convenient alternative.&lt;br /&gt;
EXTRACT EXRESSION as: EXTRACT(MONTH FROM wk)&lt;br /&gt;
other components that may be extracted:&lt;br /&gt;
    YEAR&lt;br /&gt;
    MONTH&lt;br /&gt;
    DAY&lt;br /&gt;
    HOUR&lt;br /&gt;
    MINUTE&lt;br /&gt;
In this example we use CAST in order to build up a date in the UK format dd/mm/yyyy&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
{{Functions ref}}&lt;/div&gt;</summary>
		<author><name>Connor</name></author>	</entry>

	</feed>