Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 28th, 2004, 05:43 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Adam H-W
Default formatting date time

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

 
Old September 28th, 2004, 10:30 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Adam,

This should do what you're after
Code:
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

 
Old September 28th, 2004, 01:46 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Adam H-W
Default

thanks Chris

 
Old September 28th, 2004, 07:28 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

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
 
Old September 29th, 2004, 03:35 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Adam H-W
Default

thanks guys - sorted.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Formatting Time Output braunj ASP.NET 2.0 Basics 0 October 6th, 2008 10:27 PM
Formatting and creating date and Time Audioicon ASP.NET 3.5 Basics 3 September 22nd, 2008 07:58 PM
Formatting a Field Containing a Time to AM/PM taleriana XSLT 2 March 16th, 2004 11:10 PM
Time: formatting from seconds to serial comets Classic ASP Basics 2 July 22nd, 2003 04:00 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.