Subject: formatting date time
Posted By: Adam H-W Post Date: 9/28/2004 5:43:39 AM
Hi there

Can anyone tell me the code for formatting the date so that it outputs like so:

September 28, 2004

At the moment it's outputting like this:

Tuesday, September 28, 2004

and I'm using (formatDateTime(myDate,1))

thanks alot

Reply By: ChrisScott Reply Date: 9/28/2004 10:30:58 AM
Hi Adam,

This should do what you're after

Function MyDateFormat(pDate)
    Dim months: months = Array("January", "February", "March", "April", "May", "June", _
                "July", "August", "September", "October", "November", "December")
    MyDateFormat = months(Month(pDate) - 1) & " " & Day(pDate) & ", " & Year(pDate)
End Function

HTH,

Chris

Reply By: Adam H-W Reply Date: 9/28/2004 1:46:39 PM
thanks Chris

Reply By: mat41 Reply Date: 9/28/2004 7:28:21 PM
Adam H-W

No real need for the array if you want to minimize your code, try this:

-------------cut n paste--------------------
<%= monthName(Month(Date)) & "&nbsp;" & DatePart("d", date) & ",&nbsp;" & DatePart("yyyy", date)  %>
-------------finish------------------------

Wind is your friend
Matt
Reply By: Adam H-W Reply Date: 9/29/2004 3:35:01 AM
thanks guys - sorted.


Go to topic 19796

Return to index page 760
Return to index page 759
Return to index page 758
Return to index page 757
Return to index page 756
Return to index page 755
Return to index page 754
Return to index page 753
Return to index page 752
Return to index page 751