<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[FrontAccounting forum — javascript date formatter]]></title>
		<link>https://frontaccounting.com/punbb/viewtopic.php?id=3051</link>
		<atom:link href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=3051&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in javascript date formatter.]]></description>
		<lastBuildDate>Wed, 09 May 2012 04:44:51 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[javascript date formatter]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=12423#p12423</link>
			<description><![CDATA[<p>Hi Guys<br />I have a date formatter piece of javascript that turns a date eg 011211 into 01/12/2011.<br />I&#039;m just wondering where I would add this to the code to activate it for things like OrderDate in Direct Invoice.?<br />Thanks<br />Pete</p><div class="codebox"><pre><code>function addSlashes(input) {
    var v = input.value;
    var startYear = &#039;&#039;;
    // If it&#039;s only 2 digits and 2 digits long, add one slash
    if (v.match(/^\d{2}$/) !== null) {
        input.value = v + &#039;/&#039;;
        // If up to year, add slash again.
    } else if (v.match(/^\d{2}\/\d{2}$/) !== null) {
        input.value = v + &#039;/&#039;;
    }
    // If six chars, add year
    
    if (v.match(/^\d{2}\/\d{2}\/\d{2}$/)) {
        
        // 24/12/08 
// substring from - to (to is char position so always &gt; from)

        if (v.substring(6,8)&gt;30) {
            startYear = &#039;19&#039;;
        }
        else {
            startYear = &#039;20&#039;;
        }
        input.value = input.value.substring(0,6)  + startYear + input.value.substring(6,8);
    }
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (p2409)]]></author>
			<pubDate>Wed, 09 May 2012 04:44:51 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=12423#p12423</guid>
		</item>
	</channel>
</rss>
