Print Page | Close Window

Order By

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=7926
Printed Date: 01 April 2026 at 5:47am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Order By
Posted By: WookMaster
Subject: Order By
Date Posted: 07 December 2003 at 7:13pm

I am using this

' strSQL = "SELECT jobtable.jobname, jobtable.postdate FROM jobtable ORDER BY postdate DESC;"

 

Postdate is in format 12/5/2003

 

Problem is when I get above 9,  say 10 the two digit goes to the bottom when it should be up top as it is higher.  I am geting the system date with this

 

'value="<% Response.Write(Date)%>

Is there any way to make it format like this:  12/07/2003 instead of 12/7/2003,  I find when i manually input the date that like it works fine.

 

Thanks




Replies:
Posted By: aalavar
Date Posted: 08 December 2003 at 8:08am
Sounds to me like you have the date in your database as text, and not date/time.  If you look at the data as text, the sql statement is returning the correct information.  Try changing your database postdate to date format and it should work fine.


Posted By: MorningZ
Date Posted: 08 December 2003 at 8:57am

or you can convert it in the SQL statement and leave your database alone

SELECT jobtable.jobname, jobtable.postdate FROM jobtable ORDER BY Cdate(postdate) DESC

that'll for sure work in SQL, dunno about Access, but you can try it



-------------
Contribute to the working anarchy we fondly call the Internet


Posted By: aalavar
Date Posted: 08 December 2003 at 9:14am

It works in access too actually...

Can also do something like this to format it if you really want:

SELECT jobtable.jobname, format(jobtable.postdate,'mm/dd/yyyy')FROM jobdable ORDER BY Cdate(postdate) DESC;

I've never used Cdate before, that's useful :)

 



Posted By: WookMaster
Date Posted: 09 December 2003 at 6:02am
Thanks Guys



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net