<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Web Development is my life &#187; Intranet System</title>
	<atom:link href="http://www.acidrazor.com/blog/tag/intranet-system/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.acidrazor.com/blog</link>
	<description>a resource of everything I know about Web Development or related technology including some articles I find interesting</description>
	<lastBuildDate>Tue, 17 Nov 2009 09:55:13 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.3</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Date Defaults &#8211; What every programmer should know</title>
		<link>http://www.acidrazor.com/blog/date-defaults-what-every-programmer-should-know/</link>
		<comments>http://www.acidrazor.com/blog/date-defaults-what-every-programmer-should-know/#comments</comments>
		<pubDate>Sun, 01 Feb 2009 19:56:00 +0000</pubDate>
		<dc:creator>AcidRaZor</dc:creator>
				<category><![CDATA[Classic ASP]]></category>
		<category><![CDATA[Programming 101]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Amp]]></category>
		<category><![CDATA[Date Formats]]></category>
		<category><![CDATA[Dd]]></category>
		<category><![CDATA[Getdate]]></category>
		<category><![CDATA[Heart Ache]]></category>
		<category><![CDATA[Intranet System]]></category>
		<category><![CDATA[Ms Access]]></category>
		<category><![CDATA[Programmer]]></category>
		<category><![CDATA[Programmers]]></category>
		<category><![CDATA[Raw Data]]></category>
		<category><![CDATA[Server 2000]]></category>
		<category><![CDATA[Server Example]]></category>
		<category><![CDATA[Shameless Act]]></category>
		<category><![CDATA[Silver Bullet]]></category>
		<category><![CDATA[Sleepless Nights]]></category>
		<category><![CDATA[Surety]]></category>
		<category><![CDATA[Timezone Settings]]></category>
		<category><![CDATA[Werewolf]]></category>
		<category><![CDATA[Yyyy]]></category>

		<guid isPermaLink="false">http://www.acidrazor.com/blog/?p=17</guid>
		<description><![CDATA[A few years back when I started programming my first task was to code an intranet system able to track meetings and certain tasks employees did throughout the day based on a calendar. This was before I knew what power SQL Server 2000 (and now 2005/2008) had and how easy it was working within those [...]]]></description>
			<content:encoded><![CDATA[<p>A few years back when I started programming my first task was to code an intranet system able to track meetings and certain tasks employees did throughout the day based on a calendar. This was before I knew what power SQL Server 2000 (and now 2005/2008) had and how easy it was working within those systems.</p>
<p>MS Access (which changed a lot since 1999) had one flaw. It always kept the date formats in mm/dd/yyyy (America is the &#8220;world&#8221; hahahahaha) so this made my job increasingly difficult trying to handle the dates on a South African based time (dd/mm/yyyy)</p>
<p>I struggled hard to understand the shameless act to which MS Access butchered my date inputs but I couldn&#8217;t help but think that this CAN&#8217;T happen to all programmers!!</p>
<p>After a lot of heart-ache and a lot of sleepless nights I finally found the silver bullet to the werewolf that was MS Access (and other servers worldwide running on different timezone settings)</p>
<p>dd-MMM-yyyy!!! Translated into: 01-Jan-1999 for example, you can insert ANY date with 100% surety that your sleep WILL guaranteed. This universal date format will work in ANY (yes you read it! ANY) database known to man and even though your raw data may look like 09/02/1999 in the database, it will always insert the correct date in the correct format in the database irrespective of what timezone the server is set on!</p>
<p>Classic ASP exampes of reading the date out is:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="asp" style="font-family:monospace;"><span style="color: #330066;">Day</span><span style="color: #006600; font-weight:bold;">&#40;</span>date<span style="color: #006600; font-weight:bold;">&#40;</span><span style="color: #006600; font-weight:bold;">&#41;</span><span style="color: #006600; font-weight:bold;">&#41;</span> <span style="color: #006600; font-weight: bold;">&amp;</span>amp<span style="color: #006600; font-weight: bold;">;</span> <span style="color: #cc0000;">&quot;-&quot;</span> <span style="color: #006600; font-weight: bold;">&amp;</span>amp<span style="color: #006600; font-weight: bold;">;</span> Left<span style="color: #006600; font-weight:bold;">&#40;</span><span style="color: #330066;">MonthName</span><span style="color: #006600; font-weight:bold;">&#40;</span><span style="color: #330066;">Month</span><span style="color: #006600; font-weight:bold;">&#40;</span>Date<span style="color: #006600; font-weight:bold;">&#40;</span><span style="color: #006600; font-weight:bold;">&#41;</span><span style="color: #006600; font-weight:bold;">&#41;</span><span style="color: #006600; font-weight:bold;">&#41;</span>,<span style="color: #800000;">3</span><span style="color: #006600; font-weight:bold;">&#41;</span> <span style="color: #006600; font-weight: bold;">&amp;</span>amp<span style="color: #006600; font-weight: bold;">;</span> <span style="color: #cc0000;">&quot;-&quot;</span> <span style="color: #006600; font-weight: bold;">&amp;</span>amp<span style="color: #006600; font-weight: bold;">;</span> <span style="color: #330066;">Year</span><span style="color: #006600; font-weight:bold;">&#40;</span>Date<span style="color: #006600; font-weight:bold;">&#40;</span><span style="color: #006600; font-weight:bold;">&#41;</span><span style="color: #006600; font-weight:bold;">&#41;</span></pre></td></tr></table></div>

<p>SQL Server example would use DateName instead of MonthName (which can be abbreviated without the Left() function I had to use in ASP) and of course, date() = getdate() in SQL Server <img src='http://www.acidrazor.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>I would always recommend reading it out of the database (whenever possible) with stored procedures in the correct format to begin with. But it&#8217;s up to you to decide how to use this gem of knowledge I just thrown at you. And if you&#8217;re reading this thinking &#8220;But I already knew this!&#8221; then think again. Unfortunately, in 2009, there are still quite a few programmers unable to grasp simple concepts like timezones and date handling.</p>
<p>Remember kids. Making mistakes when you&#8217;re still new in the game is one thing. Brandishing a CV (Resume) of 3 years+ experience and still making these mistakes is just plain wrong&#8230; you chose a field where you have to evolve and look for answers constantly, don&#8217;t stagnate&#8230; I&#8217;ll haunt your dreams if you do <img src='http://www.acidrazor.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.acidrazor.com/blog/date-defaults-what-every-programmer-should-know/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
