Changing Date Format

Results 1 to 2 of 2

Thread: Changing Date Format

  1. #1
    Join Date
    Dec 1969

    Default Changing Date Format

    Hi<BR><BR>I have a SQL table that has a date column in the format e.g. <BR>23-8-2001 (UK Format). I use these dates to populate a drop down box in ASP. The problem I have having is that the dates at the start of the month i.e. 1-8-2001 to 9-8-2001 appear at the bottom of the drop down box because they don&#039;t have a &#039;0&#039; at the front of them.<BR><BR>How would I change the single figures to read 01-8-2001 to 09-8-2001 before I populate my drop down box?<BR><BR>Thanks in advance.

  2. #2
    Join Date
    Dec 1969

    Default RE: Changing Date Format

    in JScript<BR><BR>var Objdate = new Date(rst("Date"));<BR><BR>var Day = ObjDate.getDate();<BR>if (day.length == 1){<BR>Response.write("&#060;option&#062;0" + rst("date")+ "&#060;/option");<BR>} else<BR>{<BR>Response.write("&#060;option&#062;" + rst("date")+ "&#060;/option");<BR>}<BR><BR>Not sure of VB syntax for this, but I&#039;m sure someone will help!<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts