<?xml version="1.0"?><rss version="2.0"><channel><title>Comments on VBScript Date Format Functions - ILoveJackDaniels.com</title><link>http://www.ilovejackdaniels.com/article/vbscript-date-format-functions/</link><description>Latest comments on VBScript Date Format Functions on ILoveJackDaniels.com</description><item><title>Comment on VBScript Date Format Functions</title><link>http://www.ilovejackdaniels.com/article/vbscript-date-format-functions/comments/</link><guid>http://www.ilovejackdaniels.com/article/vbscript-date-format-functions/comments/</guid><description>Comment by Steven Cheshire ( &lt;a href="http://"&gt;http://&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;I'm trying to call a function in ASP VBScript&lt;br /&gt;&lt;br /&gt;&lt;%=Month(Now())%&gt;&lt;br /&gt;Which qives the result for the current month as &lt;br /&gt;1, 2, 3 etc to 12 depending upon the current month.&lt;br /&gt;&lt;br /&gt;However, I need the month to be returned as a double number... i.e February to be returned as 02 as opposed to 2 which happens with &lt;%=Month(Now())%&gt;&lt;br /&gt;&lt;br /&gt;Any help much appreciated.</description></item><item><title>Comment on VBScript Date Format Functions</title><link>http://www.ilovejackdaniels.com/article/vbscript-date-format-functions/comments/</link><guid>http://www.ilovejackdaniels.com/article/vbscript-date-format-functions/comments/</guid><description>Comment by Nerijus ( &lt;a href="http://"&gt;http://&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;Matts code works for me. Thank you</description></item><item><title>Comment on VBScript Date Format Functions</title><link>http://www.ilovejackdaniels.com/article/vbscript-date-format-functions/comments/</link><guid>http://www.ilovejackdaniels.com/article/vbscript-date-format-functions/comments/</guid><description>Comment by Randy Syring ( &lt;a href="http://rcs-comp.com"&gt;http://rcs-comp.com&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;Note that in my summary function above, there is a bug that can set the local incorrectly.  &lt;br /&gt;&lt;br /&gt;' Test to see if intTimeStamp looks valid. If not, they have passed a normal date&lt;br /&gt;if not (isnumeric(intTimeStamp)) then&lt;br /&gt;    if isdate(intTimeStamp) then&lt;br /&gt;        intTimeStamp = DateDiff(&quot;S&quot;, &quot;01/01/1970 00:00:00&quot;, intTimeStamp)&lt;br /&gt;    else&lt;br /&gt;        formatDate = &quot;&quot;&lt;br /&gt;        'RETURN LOCALE TO ORIGINAL SETTING&lt;br /&gt;        SetLocale(OriginalLocale)&lt;br /&gt;        exit function&lt;br /&gt;    end if&lt;br /&gt;end if</description></item><item><title>Comment on VBScript Date Format Functions</title><link>http://www.ilovejackdaniels.com/article/vbscript-date-format-functions/comments/</link><guid>http://www.ilovejackdaniels.com/article/vbscript-date-format-functions/comments/</guid><description>Comment by Matt in Richmond, Virginia ( &lt;a href="http://"&gt;http://&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;I like the idea, but decided to modify it to use traditional VB date/time formatting.  Here is what I've come up with.  I have only tested it as a standalone vbscript, but it should be fairly robust and bullet proof.&lt;br /&gt;&lt;br /&gt;You pass usrFormatDateTime two parameters:&lt;br /&gt;&lt;br /&gt;* A date (preferably a valid one or it will default to Now()).&lt;br /&gt;* A standardized date/time format, e.g. ddd mm/dd/yyyy&lt;br /&gt;&lt;br /&gt;The script uses regular expressions to trap the correct sequences and return a properly formatted date.&lt;br /&gt;&lt;br /&gt;Example:&lt;br /&gt;&lt;br /&gt;usrFormatDateTime(&quot;03/17/2007&quot;,&quot;dddd MMMM dd, yyyy&quot;)  &lt;br /&gt;&lt;br /&gt;returns  Saturday, March 17, 2007&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Function usrFormatDateTime(dtmInputDate,strDateTimeFormat)&lt;br /&gt;  'Required Parameters:&lt;br /&gt;  '&lt;br /&gt;  'dtmInputDate      : A Date String or Date Value.&lt;br /&gt;  'strDateTimeFormat : A String specifying the desired format using Microsoft MSDN standards.&lt;br /&gt;  '&lt;br /&gt;  'Date/Time Standard Formats - Case-Sensitive.&lt;br /&gt;  '********************************************&lt;br /&gt;  'M      : Months 1-12&lt;br /&gt;  'MM     : Months 01-12&lt;br /&gt;  'MMM    : Month Names in three-char abbreviated format&lt;br /&gt;  'MMMM   : Month Names&lt;br /&gt;  'd      : Days 1-31&lt;br /&gt;  'dd     : Days 01-31&lt;br /&gt;  'ddd    : Day Names in three-char abbreviated format&lt;br /&gt;  'dddd   : Day Names&lt;br /&gt;  'yy     : Two-digit Year&lt;br /&gt;  'yyyy   : Four-digit Year&lt;br /&gt;  'h      : Hours 1-12, 12-hour format&lt;br /&gt;  'hh     : Hours 01-12, 12-hour format&lt;br /&gt;  'H      : Hours 0-23, 24-hour format&lt;br /&gt;  'HH     : Hours 00-23,24-hour format&lt;br /&gt;  'm      : Minutes 0-59&lt;br /&gt;  'mm     : Minutes 00-59&lt;br /&gt;  's      : Seconds 0-59&lt;br /&gt;  'ss     : Seconds 00-59&lt;br /&gt;  't      : AM or PM&lt;br /&gt;  &lt;br /&gt;  'Use Current Date and Time if value passed is not a date.&lt;br /&gt;  If Not IsDate(dtmInputDate) then&lt;br /&gt;    dtmInputDate = Now()&lt;br /&gt;  End if&lt;br /&gt;  &lt;br /&gt;  Dim strFormattedDateTime&lt;br /&gt;  &lt;br /&gt;  'Prepare a regular expression object to manage search and replace of formatting strings.&lt;br /&gt;  Dim objFormattedDateRegExp&lt;br /&gt;  Set objFormattedDateRegExp = New RegExp&lt;br /&gt;  objFormattedDateRegExp.IgnoreCase = False&lt;br /&gt;  objFormattedDateRegExp.Global = True&lt;br /&gt;  &lt;br /&gt;  strFormattedDateTime = strDateTimeFormat&lt;br /&gt;  &lt;br /&gt;  'The following presume that Sunday is first day of the week.&lt;br /&gt;  'Refer to documentation on the WEEKDAYNAME() and WEEKDAY() functions, to adjust if needed.&lt;br /&gt;  Dim intMonth  &lt;br /&gt;  Dim intDay    &lt;br /&gt;  Dim intYear   &lt;br /&gt;  Dim intHour   &lt;br /&gt;  Dim intMinute &lt;br /&gt;  Dim intSecond &lt;br /&gt;  Dim strWeekday    &lt;br /&gt;  Dim strMonth&lt;br /&gt;  Dim strAMPM&lt;br /&gt;  &lt;br /&gt;  intMonth   = Month(dtmInputDate)&lt;br /&gt;  intDay     = Day(dtmInputDate)&lt;br /&gt;  intYear    = Year(dtmInputDate)&lt;br /&gt;  intHour    = Hour(dtmInputDate)&lt;br /&gt;  intMinute  = Minute(dtmInputDate)&lt;br /&gt;  intSecond  = Second(dtmInputDate)&lt;br /&gt;  strWeekday = WeekdayName(Weekday(dtmInputDate))&lt;br /&gt;  strMonth   = MonthName(intMonth)&lt;br /&gt;  strAMPM    = &quot;AM&quot;&lt;br /&gt;  &lt;br /&gt;  'Replace the Month format.&lt;br /&gt;  '************************&lt;br /&gt;  objFormattedDateRegExp.Pattern = &quot;MMMM&quot;&lt;br /&gt;  strFormattedDateTime = objFormattedDateRegExp.Replace(strFormattedDateTime, strMonth)&lt;br /&gt;  objFormattedDateRegExp.Pattern = &quot;MMM&quot;&lt;br /&gt;  strFormattedDateTime = objFormattedDateRegExp.Replace(strFormattedDateTime, UCase(Left(strMonth,3)))&lt;br /&gt;  objFormattedDateRegExp.Pattern = &quot;MM&quot;&lt;br /&gt;  strFormattedDateTime = objFormattedDateRegExp.Replace(strFormattedDateTime, Right(&quot;0&quot; &amp; intMonth,2))&lt;br /&gt;  'Watch out for m's in the month name or month name abbrev.&lt;br /&gt;  objFormattedDateRegExp.Pattern = &quot;(M(?=[^AaBbOo])|M$)~^([Ee]M)&quot;&lt;br /&gt;  strFormattedDateTime = objFormattedDateRegExp.Replace(strFormattedDateTime, intMonth)&lt;br /&gt;  &lt;br /&gt;  'Replace the Day format.&lt;br /&gt;  '************************&lt;br /&gt;  objFormattedDateRegExp.Pattern = &quot;dddd&quot;&lt;br /&gt;  strFormattedDateTime = objFormattedDateRegExp.Replace(strFormattedDateTime, strWeekday)&lt;br /&gt;  objFormattedDateRegExp.Pattern = &quot;ddd&quot;&lt;br /&gt;  strFormattedDateTime = objFormattedDateRegExp.Replace(strFormattedDateTime, UCase(Left(strWeekday,3)))&lt;br /&gt;  objFormattedDateRegExp.Pattern = &quot;dd&quot;&lt;br /&gt;  strFormattedDateTime = objFormattedDateRegExp.Replace(strFormattedDateTime, Right(&quot;0&quot; &amp; intDay,2))&lt;br /&gt;  'Watch out for m's in the day name or day name abbrev.&lt;br /&gt;  objFormattedDateRegExp.Pattern = &quot;(d(?=[^EeAaNn])|d$)^([Nn]d|[Ss]d|[Ii]d|[Rr]d)&quot;&lt;br /&gt;  strFormattedDateTime = objFormattedDateRegExp.Replace(strFormattedDateTime, intDay)&lt;br /&gt;  &lt;br /&gt;  'Replace the Year format.&lt;br /&gt;  '************************&lt;br /&gt;  objFormattedDateRegExp.Pattern = &quot;yyyy&quot;&lt;br /&gt;  strFormattedDateTime = objFormattedDateRegExp.Replace(strFormattedDateTime, intYear)&lt;br /&gt;  objFormattedDateRegExp.Pattern = &quot;yy&quot;&lt;br /&gt;  strFormattedDateTime = objFormattedDateRegExp.Replace(strFormattedDateTime, Right(intYear,2))&lt;br /&gt;  &lt;br /&gt;  'Replace the Hour format.&lt;br /&gt;  '************************&lt;br /&gt;  '24-Hour format&lt;br /&gt;  objFormattedDateRegExp.Pattern = &quot;HH&quot;&lt;br /&gt;  strFormattedDateTime = objFormattedDateRegExp.Replace(strFormattedDateTime, Right(&quot;0&quot; &amp; intHour,2))&lt;br /&gt;  objFormattedDateRegExp.Pattern = &quot;(H(?=[^Uu])|H$)^([Cc]H|[Tt]H)&quot;&lt;br /&gt;  strFormattedDateTime = objFormattedDateRegExp.Replace(strFormattedDateTime, intHour)&lt;br /&gt;  &lt;br /&gt;  '12-Hour format&lt;br /&gt;  'At this point, you are done with the intHour formatted in 24-hour time, so drop it to a 12-Hour format.&lt;br /&gt;  If intHour &gt; 12 Then&lt;br /&gt;    intHour = intHour - 12&lt;br /&gt;    strAMPM = &quot;PM&quot;&lt;br /&gt;  End If&lt;br /&gt;  If intHour = 0 Then&lt;br /&gt;    intHour = 12&lt;br /&gt;  End If&lt;br /&gt;  objFormattedDateRegExp.Pattern = &quot;hh&quot;&lt;br /&gt;  strFormattedDateTime = objFormattedDateRegExp.Replace(strFormattedDateTime, Right(&quot;0&quot; &amp; intHour,2))&lt;br /&gt;  objFormattedDateRegExp.Pattern = &quot;(h(?=[^Uu])|h$)^([Cc]h|[Tt]h)&quot;&lt;br /&gt;  strFormattedDateTime = objFormattedDateRegExp.Replace(strFormattedDateTime, intHour)&lt;br /&gt;  &lt;br /&gt;  'Replace the Minute format.&lt;br /&gt;  '************************&lt;br /&gt;  objFormattedDateRegExp.Pattern = &quot;mm&quot;&lt;br /&gt;  strFormattedDateTime = objFormattedDateRegExp.Replace(strFormattedDateTime, Right(&quot;0&quot; &amp; intMinute,2))&lt;br /&gt;  objFormattedDateRegExp.Pattern = &quot;(m(?=[^AaBbOo])|m$)^([Ee]m)&quot;&lt;br /&gt;  strFormattedDateTime = objFormattedDateRegExp.Replace(strFormattedDateTime, intMinute)&lt;br /&gt;  &lt;br /&gt;  'Replace the Second format.&lt;br /&gt;  '************************&lt;br /&gt;  objFormattedDateRegExp.Pattern = &quot;ss&quot;&lt;br /&gt;  strFormattedDateTime = objFormattedDateRegExp.Replace(strFormattedDateTime, Right(&quot;0&quot; &amp; intSecond,2))&lt;br /&gt;  objFormattedDateRegExp.Pattern = &quot;(s(?=[^TtEeUuDdAa])|s$)^([Uu]s|[Ee]s|[Rr]s)&quot;&lt;br /&gt;  strFormattedDateTime = objFormattedDateRegExp.Replace(strFormattedDateTime, intSecond)&lt;br /&gt;  &lt;br /&gt;  'Replace the AM/PM format.&lt;br /&gt;  '************************&lt;br /&gt;  objFormattedDateRegExp.Pattern = &quot;(t(?=[^HhUuEeOo])|t$)^([Ss]t|[Aa]t|[Pp]t|[Cc]t)&quot;&lt;br /&gt;  strFormattedDateTime = objFormattedDateRegExp.Replace(strFormattedDateTime, strAMPM)&lt;br /&gt;   &lt;br /&gt;  usrFormatDateTime = strFormattedDateTime&lt;br /&gt; &lt;br /&gt;End Function</description></item><item><title>Comment on VBScript Date Format Functions</title><link>http://www.ilovejackdaniels.com/article/vbscript-date-format-functions/comments/</link><guid>http://www.ilovejackdaniels.com/article/vbscript-date-format-functions/comments/</guid><description>Comment by Hugh Abbott ( &lt;a href="http://www.bespokelearningtools.com"&gt;http://www.bespokelearningtools.com&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;Worked for me - love it!&lt;br /&gt;Also - really like the clean design of your site - simple, clean, bit of colour - loved it!&lt;br /&gt;&lt;br /&gt;Keep it up.&lt;br /&gt;Hugh Abbott&lt;br /&gt;hugh.abbott@bespokelearningtools.com</description></item><item><title>Comment on VBScript Date Format Functions</title><link>http://www.ilovejackdaniels.com/article/vbscript-date-format-functions/comments/</link><guid>http://www.ilovejackdaniels.com/article/vbscript-date-format-functions/comments/</guid><description>Comment by Pisu ( &lt;a href="http://www.thepisu.tk"&gt;http://www.thepisu.tk&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;Sorry UDate fuction was wrong...&lt;br /&gt;&lt;br /&gt;function UDate(oldDate)&lt;br /&gt;	Dim od, offset, nd, startDST, endDST&lt;br /&gt;	od = oldDate&lt;br /&gt;    ' fill in your known bias here! &lt;br /&gt;    offset = 1&lt;br /&gt;    ' find first Sunday in April &lt;br /&gt;    for i = 1 to 7 &lt;br /&gt;        if weekday(&quot;4/&quot; &amp; i &amp; &quot;/&quot; &amp; year(od))=1 then &lt;br /&gt;            startDST = cdate(&quot;4/&quot; &amp; i &amp; &quot;/&quot; &amp; year(od)) &lt;br /&gt;            exit for &lt;br /&gt;        end if &lt;br /&gt;    next &lt;br /&gt;    ' find last Sunday in October &lt;br /&gt;    for i = 31 to 25 step -1 &lt;br /&gt;        if weekday(&quot;10/&quot; &amp; i &amp; &quot;/&quot; &amp; year(od))=1 then &lt;br /&gt;            endDST = cdate(&quot;10/&quot; &amp; i &amp; &quot;/&quot; &amp; year(od)) &lt;br /&gt;            exit for &lt;br /&gt;        end if &lt;br /&gt;    next &lt;br /&gt;    ' subtract hour from offset if within DST &lt;br /&gt;    if cdate(od) &gt;= startDST and cdate(od) &lt; endDST then &lt;br /&gt;        offset = offset + 1 &lt;br /&gt;    end if &lt;br /&gt;    nd = dateadd(&quot;h&quot;, offset*(-1), od) &lt;br /&gt;    UDate = DateDiff(&quot;s&quot;, &quot;01/01/1970 00:00:00&quot;, nd)&lt;br /&gt;end function</description></item><item><title>Comment on VBScript Date Format Functions</title><link>http://www.ilovejackdaniels.com/article/vbscript-date-format-functions/comments/</link><guid>http://www.ilovejackdaniels.com/article/vbscript-date-format-functions/comments/</guid><description>Comment by Pisu ( &lt;a href="http://www.thepisu.tk"&gt;http://www.thepisu.tk&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;I found a problem: Unix timestamp is UTC (timezone GMT without daylight saving), ASP Date is localized... So in example in Italy (GMT+1) in daylight saving period, the function &quot;unUDate&quot; give me  a result 2 hour in advance... I found this solution (you have to set your offset from GMT...):&lt;br /&gt;&lt;br /&gt;function UDate(oldDate)&lt;br /&gt;	Dim od, offset, nd, startDST, endDST&lt;br /&gt;	UDate = DateDiff(&quot;s&quot;, &quot;01/01/1970 00:00:00&quot;, oldDate)&lt;br /&gt;	od = DateAdd(&quot;s&quot;, intTimeStamp, &quot;01/01/1970 00:00:00&quot;)&lt;br /&gt;    ' fill in your known bias here! &lt;br /&gt;    offset = 1&lt;br /&gt;    ' find first Sunday in April &lt;br /&gt;    for i = 1 to 7 &lt;br /&gt;        if weekday(&quot;4/&quot; &amp; i &amp; &quot;/&quot; &amp; year(od))=1 then &lt;br /&gt;            startDST = cdate(&quot;4/&quot; &amp; i &amp; &quot;/&quot; &amp; year(od)) &lt;br /&gt;            exit for &lt;br /&gt;        end if &lt;br /&gt;    next &lt;br /&gt;    ' find last Sunday in October &lt;br /&gt;    for i = 31 to 25 step -1 &lt;br /&gt;        if weekday(&quot;10/&quot; &amp; i &amp; &quot;/&quot; &amp; year(od))=1 then &lt;br /&gt;            endDST = cdate(&quot;10/&quot; &amp; i &amp; &quot;/&quot; &amp; year(od)) &lt;br /&gt;            exit for &lt;br /&gt;        end if &lt;br /&gt;    next &lt;br /&gt;    ' subtract hour from offset if within DST &lt;br /&gt;    if cdate(od) &gt;= startDST and cdate(od) &lt; endDST then &lt;br /&gt;        offset = offset + 1 &lt;br /&gt;    end if &lt;br /&gt;    nd = dateadd(&quot;h&quot;, offset*(-1), od) &lt;br /&gt;    unUDate = nd&lt;br /&gt;end function&lt;br /&gt;&lt;br /&gt;function unUDate(intTimeStamp)&lt;br /&gt;	Dim od, offset, nd, startDST, endDST&lt;br /&gt;	od = DateAdd(&quot;s&quot;, intTimeStamp, &quot;01/01/1970 00:00:00&quot;)&lt;br /&gt;    ' fill in your known bias here! &lt;br /&gt;    offset = 1&lt;br /&gt;    ' find first Sunday in April &lt;br /&gt;    for i = 1 to 7 &lt;br /&gt;        if weekday(&quot;4/&quot; &amp; i &amp; &quot;/&quot; &amp; year(od))=1 then &lt;br /&gt;            startDST = cdate(&quot;4/&quot; &amp; i &amp; &quot;/&quot; &amp; year(od)) &lt;br /&gt;            exit for &lt;br /&gt;        end if &lt;br /&gt;    next &lt;br /&gt;    ' find last Sunday in October &lt;br /&gt;    for i = 31 to 25 step -1 &lt;br /&gt;        if weekday(&quot;10/&quot; &amp; i &amp; &quot;/&quot; &amp; year(od))=1 then &lt;br /&gt;            endDST = cdate(&quot;10/&quot; &amp; i &amp; &quot;/&quot; &amp; year(od)) &lt;br /&gt;            exit for &lt;br /&gt;        end if &lt;br /&gt;    next &lt;br /&gt;    ' subtract hour from offset if within DST &lt;br /&gt;    if cdate(od) &gt;= startDST and cdate(od) &lt; endDST then &lt;br /&gt;        offset = offset + 1 &lt;br /&gt;    end if &lt;br /&gt;    nd = dateadd(&quot;h&quot;, offset, od) &lt;br /&gt;    unUDate = nd&lt;br /&gt;end function</description></item><item><title>Comment on VBScript Date Format Functions</title><link>http://www.ilovejackdaniels.com/article/vbscript-date-format-functions/comments/</link><guid>http://www.ilovejackdaniels.com/article/vbscript-date-format-functions/comments/</guid><description>Comment by Randy Syring ( &lt;a href="http://rcswebsolutions.wordpress.org/"&gt;http://rcswebsolutions.wordpress.org/&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;As best as I can tell, here is the function with all the updates from the comments:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;function formatDate(format, intTimeStamp)&lt;br /&gt;Dim monthname()&lt;br /&gt;Redim monthname(12)&lt;br /&gt;monthname(1) = &quot;January&quot;&lt;br /&gt;monthname(2) = &quot;February&quot;&lt;br /&gt;monthname(3) = &quot;March&quot;&lt;br /&gt;monthname(4) = &quot;April&quot;&lt;br /&gt;monthname(5) = &quot;May&quot;&lt;br /&gt;monthname(6) = &quot;June&quot;&lt;br /&gt;monthname(7) = &quot;July&quot;&lt;br /&gt;monthname(8) = &quot;August&quot;&lt;br /&gt;monthname(9) = &quot;September&quot;&lt;br /&gt;monthname(10) = &quot;October&quot;&lt;br /&gt;monthname(11) = &quot;November&quot;&lt;br /&gt;monthname(12) = &quot;December&quot;&lt;br /&gt;&lt;br /&gt;dim unUDate, A&lt;br /&gt;&lt;br /&gt;dim OriginalLocale&lt;br /&gt;dim res&lt;br /&gt;OriginalLocale = GetLocale&lt;br /&gt;res = SetLocale(&quot;en-gb&quot;)&lt;br /&gt;&lt;br /&gt;' Test to see if intTimeStamp looks valid. If not, they have passed a normal date&lt;br /&gt;if not (isnumeric(intTimeStamp)) then&lt;br /&gt;if isdate(intTimeStamp) then&lt;br /&gt;intTimeStamp = DateDiff(&quot;S&quot;, &quot;01/01/1970 00:00:00&quot;, intTimeStamp)&lt;br /&gt;else&lt;br /&gt;response.write &quot;Date Invalid&quot;&lt;br /&gt;exit function&lt;br /&gt;end if&lt;br /&gt;end if&lt;br /&gt;&lt;br /&gt;if (intTimeStamp=0) then&lt;br /&gt;unUDate = now()&lt;br /&gt;else&lt;br /&gt;unUDate = DateAdd(&quot;s&quot;, intTimeStamp, &quot;01/01/1970 00:00:00&quot;)&lt;br /&gt;end if&lt;br /&gt;&lt;br /&gt;unUDate = trim(unUDate)&lt;br /&gt;&lt;br /&gt;'bug fix for midnight problems&lt;br /&gt;If (Len(unUDate) &lt;= 11) Then unUDate = Trim(unUDate) &amp; &quot; 00:00:00&quot; &lt;br /&gt;&lt;br /&gt;dim startM : startM = 1&lt;br /&gt;dim startD : startD = InStr(startM, unUDate, &quot;/&quot;)+1&lt;br /&gt;dim startY : startY = InStr(startD, unUDate, &quot;/&quot;)+1&lt;br /&gt;dim startHour : startHour = InStr(startY, unUDate, &quot; &quot;)+1&lt;br /&gt;dim startMin : startMin = InStr(startHour, unUDate, &quot;:&quot;)+1&lt;br /&gt;dim startSec : startSec = InStr(startMin+1, unUDate, &quot;:&quot;)+1&lt;br /&gt;dim dateMonth : dateMonth = mid(unUDate, startD, ((startY - 1) - startD)) &lt;br /&gt;dim dateDay : dateDay = mid(unUDate, 1, ((startD - 1) - 1)) &lt;br /&gt;dim dateYear : dateYear = Year(unUDate)&lt;br /&gt;dim dateHour : dateHour = mid(unUDate, startHour, ((startMin - startHour) - 1))&lt;br /&gt;dim dateMinute : dateMinute = mid(unUDate, startMin, 2)&lt;br /&gt;dim dateSecond : dateSecond = mid(unUDate, InStr(startMin, unUDate, &quot;:&quot;) + 1, 2)&lt;br /&gt;&lt;br /&gt;format = replace(format, &quot;%Y&quot;, right(dateYear, 4))&lt;br /&gt;format = replace(format, &quot;%y&quot;, right(dateYear, 2))&lt;br /&gt;format = replace(format, &quot;%m&quot;, dateMonth)&lt;br /&gt;format = replace(format, &quot;%n&quot;, cint(dateMonth))&lt;br /&gt;&lt;br /&gt;' Response.Write CStr(cint(dateMonth))&lt;br /&gt;' Response.Flush&lt;br /&gt;&lt;br /&gt;format = replace(format, &quot;%F&quot;, monthname(cint(dateMonth)))&lt;br /&gt;format = replace(format, &quot;%M&quot;, left(monthname(cint(dateMonth)), 3))&lt;br /&gt;format = replace(format, &quot;%d&quot;, dateDay)&lt;br /&gt;format = replace(format, &quot;%j&quot;, cint(dateDay))&lt;br /&gt;format = replace(format, &quot;%h&quot;, mid(unUDate, startHour, 2))&lt;br /&gt;format = replace(format, &quot;%g&quot;, cint(mid(unUDate, startHour, 2)))&lt;br /&gt;&lt;br /&gt;if (cint(dateHour) &gt; 12) then&lt;br /&gt;A = &quot;PM&quot;&lt;br /&gt;else&lt;br /&gt;A = &quot;AM&quot;&lt;br /&gt;end if&lt;br /&gt;format = replace(format, &quot;%A&quot;, A)&lt;br /&gt;format = replace(format, &quot;%a&quot;, lcase(A))&lt;br /&gt;&lt;br /&gt;if (A = &quot;PM&quot;) then format = replace(format, &quot;%H&quot;, Right(&quot;00&quot; &amp; dateHour - 12, 2))&lt;br /&gt;format = replace(format, &quot;%H&quot;, dateHour)&lt;br /&gt;if (A = &quot;PM&quot;) then format = replace(format, &quot;%G&quot;, left(&quot;0&quot; &amp; cint(dateHour) - 12, 2))&lt;br /&gt;format = replace(format, &quot;%G&quot;, cint(dateHour))&lt;br /&gt;&lt;br /&gt;format = replace(format, &quot;%i&quot;, dateMinute)&lt;br /&gt;format = replace(format, &quot;%I&quot;, cint(dateMinute))&lt;br /&gt;format = replace(format, &quot;%s&quot;, dateSecond)&lt;br /&gt;format = replace(format, &quot;%S&quot;, cint(dateSecond))&lt;br /&gt;format = replace(format, &quot;%L&quot;, WeekDay(unUDate))&lt;br /&gt;format = replace(format, &quot;%D&quot;, left(WeekDayName(WeekDay(unUDate)), 3))&lt;br /&gt;format = replace(format, &quot;%l&quot;, WeekDayName(WeekDay(unUDate)))&lt;br /&gt;format = replace(format, &quot;%U&quot;, intTimeStamp)&lt;br /&gt;format = replace(format, &quot;11%O&quot;, &quot;11th&quot;)&lt;br /&gt;format = replace(format, &quot;1%O&quot;, &quot;1st&quot;)&lt;br /&gt;format = replace(format, &quot;12%O&quot;, &quot;12th&quot;)&lt;br /&gt;format = replace(format, &quot;2%O&quot;, &quot;2nd&quot;)&lt;br /&gt;format = replace(format, &quot;13%O&quot;, &quot;13th&quot;)&lt;br /&gt;format = replace(format, &quot;3%O&quot;, &quot;3rd&quot;)&lt;br /&gt;format = replace(format, &quot;%O&quot;, &quot;th&quot;)&lt;br /&gt;&lt;br /&gt;formatDate = format&lt;br /&gt;res = SetLocale(OriginalLocale)&lt;br /&gt;&lt;br /&gt;end function</description></item><item><title>Comment on VBScript Date Format Functions</title><link>http://www.ilovejackdaniels.com/article/vbscript-date-format-functions/comments/</link><guid>http://www.ilovejackdaniels.com/article/vbscript-date-format-functions/comments/</guid><description>Comment by Ray ( &lt;a href="http://"&gt;http://&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;Why not just use the built-in functions like Month(unUDate), Day(unUDate), Year(unUDate), Hour(unUDate), Minute(unUDate), Second(unUDate)?&lt;br /&gt;&lt;br /&gt;And why would you use a Unix Date if you unUDate it in formatDate()?</description></item><item><title>Comment on VBScript Date Format Functions</title><link>http://www.ilovejackdaniels.com/article/vbscript-date-format-functions/comments/</link><guid>http://www.ilovejackdaniels.com/article/vbscript-date-format-functions/comments/</guid><description>Comment by Ray ( &lt;a href="http://"&gt;http://&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;I fixed the midnight problem by adding the following line just above the dim statements:&lt;br /&gt;&lt;br /&gt;If (Len(unUDate) &lt;= 11) Then unUDate = Trim(unUDate) &amp; &quot; 00:00:00&quot;&lt;br /&gt;&lt;br /&gt;But, doesn't the month come before the day in UK notation?&lt;br /&gt;Like 03/25/2007?</description></item></channel></rss>