 




<?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: Problem converting numeric to date data type</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/problem-converting-numeric-to-date-data-type/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers/problem-converting-numeric-to-date-data-type/</link>
	<description></description>
	<lastBuildDate>Fri, 24 May 2013 06:06:29 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/problem-converting-numeric-to-date-data-type/#comment-99045</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Tue, 15 Nov 2011 00:52:37 +0000</pubDate>
		<guid isPermaLink="false">#comment-99045</guid>
		<description><![CDATA[&lt;i&gt;CHAR(19000000 + YMD)&lt;/i&gt;

Also be aware that this is looking for 6-digit numbers in the form YYMMDD. If your date values are stored as MMDDYY or DDMMYY, you&#039;ll need to reformat them accordingly.

Also note that adding 19000000 to a 6-digit YYMMDD numeric date value will give you a year in the 20th century prior to 2000. You&#039;ll need to decide if/when to use 20000000 or 19000000.

You might be best served by creating a UDF() that does the work.

Tom]]></description>
		<content:encoded><![CDATA[<p><i>CHAR(19000000 + YMD)</i></p>
<p>Also be aware that this is looking for 6-digit numbers in the form YYMMDD. If your date values are stored as MMDDYY or DDMMYY, you&#8217;ll need to reformat them accordingly.</p>
<p>Also note that adding 19000000 to a 6-digit YYMMDD numeric date value will give you a year in the 20th century prior to 2000. You&#8217;ll need to decide if/when to use 20000000 or 19000000.</p>
<p>You might be best served by creating a UDF() that does the work.</p>
<p>Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: donethat</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/problem-converting-numeric-to-date-data-type/#comment-99039</link>
		<dc:creator>donethat</dc:creator>
		<pubDate>Mon, 14 Nov 2011 17:45:16 +0000</pubDate>
		<guid isPermaLink="false">#comment-99039</guid>
		<description><![CDATA[And don&#039;t forget to make sure you have a valid date in the field to begin with.
If not, SQL (such as the sample code provided by Philpl1jb) will barf.
Gary]]></description>
		<content:encoded><![CDATA[<p>And don&#8217;t forget to make sure you have a valid date in the field to begin with.<br />
If not, SQL (such as the sample code provided by Philpl1jb) will barf.<br />
Gary</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: philpl1jb</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/problem-converting-numeric-to-date-data-type/#comment-99014</link>
		<dc:creator>philpl1jb</dc:creator>
		<pubDate>Sun, 13 Nov 2011 17:18:59 +0000</pubDate>
		<guid isPermaLink="false">#comment-99014</guid>
		<description><![CDATA[http://www.itjungle.com/mgo/mgo050102-story02.html

Shows how to convert zoned to SQL date

DATE(
      SUBSTR(CHAR(19000000 + YMD),1,4) &#124;&#124;’-‘&#124;&#124;
      SUBSTR(CHAR(19000000 + YMD),5,2) &#124;&#124;’-‘&#124;&#124;
      SUBSTR(CHAR(19000000 + YMD),7,2)
      )

If your SQL session format is *USA and the date separator is a forward slash (/), you could also convert the date this way:


DATE(
      SUBSTR(CHAR(19000000 + YMD),5,2) &#124;&#124;’/‘&#124;&#124;
      SUBSTR(CHAR(19000000 + YMD),7,2) &#124;&#124;’/‘&#124;&#124;
      SUBSTR(CHAR(19000000 + YMD),1,4)
      )

Here are a few examples lifted from this site
1 convert the date to char parse it into date format and use date function
or
2. use math to get the parsed date sections and then convert them to char
either way the DATE function processes a char string.
Phil]]></description>
		<content:encoded><![CDATA[<p><a href="http://www.itjungle.com/mgo/mgo050102-story02.html" rel="nofollow">http://www.itjungle.com/mgo/mgo050102-story02.html</a></p>
<p>Shows how to convert zoned to SQL date</p>
<p>DATE(<br />
      SUBSTR(CHAR(19000000 + YMD),1,4) ||’-‘||<br />
      SUBSTR(CHAR(19000000 + YMD),5,2) ||’-‘||<br />
      SUBSTR(CHAR(19000000 + YMD),7,2)<br />
      )</p>
<p>If your SQL session format is *USA and the date separator is a forward slash (/), you could also convert the date this way:</p>
<p>DATE(<br />
      SUBSTR(CHAR(19000000 + YMD),5,2) ||’/‘||<br />
      SUBSTR(CHAR(19000000 + YMD),7,2) ||’/‘||<br />
      SUBSTR(CHAR(19000000 + YMD),1,4)<br />
      )</p>
<p>Here are a few examples lifted from this site<br />
1 convert the date to char parse it into date format and use date function<br />
or<br />
2. use math to get the parsed date sections and then convert them to char<br />
either way the DATE function processes a char string.<br />
Phil</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: munduuu</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/problem-converting-numeric-to-date-data-type/#comment-99003</link>
		<dc:creator>munduuu</dc:creator>
		<pubDate>Sun, 13 Nov 2011 05:19:51 +0000</pubDate>
		<guid isPermaLink="false">#comment-99003</guid>
		<description><![CDATA[Its a field of a PF and i am running it through SQL query....]]></description>
		<content:encoded><![CDATA[<p>Its a field of a PF and i am running it through SQL query&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: deepu9321</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/problem-converting-numeric-to-date-data-type/#comment-99001</link>
		<dc:creator>deepu9321</dc:creator>
		<pubDate>Sun, 13 Nov 2011 04:18:28 +0000</pubDate>
		<guid isPermaLink="false">#comment-99001</guid>
		<description><![CDATA[It Should work if you are using Date function. What is the Error Message you are getting exactly?? 
Mention Programming language, that will be better for understanding.

Pradeep.]]></description>
		<content:encoded><![CDATA[<p>It Should work if you are using Date function. What is the Error Message you are getting exactly??<br />
Mention Programming language, that will be better for understanding.</p>
<p>Pradeep.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/problem-converting-numeric-to-date-data-type/#comment-98999</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Sun, 13 Nov 2011 02:52:39 +0000</pubDate>
		<guid isPermaLink="false">#comment-98999</guid>
		<description><![CDATA[&lt;i&gt;I have a zoned decimal field as s 6&lt;/i&gt;

You have the field where? In a file? As a program variable?

&lt;i&gt; and i am trying to convert it to date format as mmddyy in sql...&lt;/i&gt;

Is this a direct SQL query? Or is it embedded SQL? (If embedded, what is the programming language?)

Tom]]></description>
		<content:encoded><![CDATA[<p><i>I have a zoned decimal field as s 6</i></p>
<p>You have the field where? In a file? As a program variable?</p>
<p><i> and i am trying to convert it to date format as mmddyy in sql&#8230;</i></p>
<p>Is this a direct SQL query? Or is it embedded SQL? (If embedded, what is the programming language?)</p>
<p>Tom</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 3/10 queries in 0.038 seconds using memcached
Object Caching 337/343 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-05-24 06:31:17 -->