Forums

This topic is locked

Dates: Month/Year Only

Posted 20 Jun 2003 11:20:07
1
has voted
20 Jun 2003 11:20:07 Dave Desormeaux posted:
I would like to display a date on my page, but only showing month and year.

I am using ACCESS 2000. The parameters for the date field are:
Data Type: Date/Time
Format: mmmm", "yyyy
Input Mask: 99/0000;;_

This displays on the asp page just fine, except that all the options in Dreamweavers date functions include the day

Right now I have the function set at "Date/Time-January 17, 2000"

My page displays, for example: January 1, 2003
(it automatically uses the first day of the month when none is in the database)

Ideally I would like the output to read "January, 2000"

Can I edit individual date functions? (How?)
Can I add a custom date function? (How?)
Can I add a custom function to the page? (Pointers?)

Thanks

Dave

Replies

Replied 20 Jun 2003 11:48:42
20 Jun 2003 11:48:42 Vince Baker replied:
Here is the code you will need to do that for todays date:

<%
Dim strDateYear, arrDate, strDate

strDate = FormatDateTime(date, 1)
arrDate = Split(strDate, " ", -1, 1)
strDateYear = arrDate(1) & " " & arrDate(2)
Response.Write(strDateYear)
%>

To make this dynamic, replace the line starting strDate = ....

with

strDate = rsYourRecordsetname.fields.item("YourDateFieldName".value
Regards
Vince

Visit my home: www.chez-vince.com

VBScript | ASP | HTML | SQL | Oracle | Hosting

Edited by - bakerv on 20 Jun 2003 11:49:56

Reply to this topic