Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dateformat..?

Status
Not open for further replies.

kenjoswe

Technical User
Sep 19, 2000
327
SE
Hi all,

How can I format a dates in
&quot;<option value=&quot;& rs.Fields(&quot;Month&quot;) &&quot;>&quot;

...to the dateformat yyyy-mmm (2002-apr)?

/Kent J.
 
I haven't found a MonthName() type of function in asp. so this is what I do:

'This array hold the names of each month
namesArray = Array(&quot;Jan&quot;, &quot;Feb&quot;, &quot;Mar&quot;, &quot;Apr&quot;, &quot;May&quot;, &quot;Jun&quot;, &quot;Jul&quot;, &quot;Aug&quot;, &quot;Sep&quot;, &quot;Oct&quot;, &quot;Nov&quot;, &quot;Dec&quot;)

monthIndex = rs.Fields(&quot;Month&quot;) + 1
titleMonth = namesArray(monthIndex)

&quot;<option value=2002-&quot; & titleMonth & &quot;>&quot;

Perhaps the array setup could be in a subroutine, a function , or an include file, depending on how often you use.
---
Another idea would be to convert the month to words in the database. If your database has a 'MonthName()' sort of function, then have it return the month name in the record set, so you don't have to worry about it in ASP.

----------------------------
hope this gives you some ideas,
bp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top