Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Order By
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Order By

 Post Reply Post Reply
Author
WookMaster View Drop Down
Newbie
Newbie


Joined: 29 November 2003
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote WookMaster Quote  Post ReplyReply Direct Link To This Post Topic: Order By
    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

Back to Top
aalavar View Drop Down
Groupie
Groupie


Joined: 08 December 2003
Status: Offline
Points: 46
Post Options Post Options   Thanks (0) Thanks(0)   Quote aalavar Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
aalavar View Drop Down
Groupie
Groupie


Joined: 08 December 2003
Status: Offline
Points: 46
Post Options Post Options   Thanks (0) Thanks(0)   Quote aalavar Quote  Post ReplyReply Direct Link To This Post 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 :)

 

Back to Top
WookMaster View Drop Down
Newbie
Newbie


Joined: 29 November 2003
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote WookMaster Quote  Post ReplyReply Direct Link To This Post Posted: 09 December 2003 at 6:02am
Thanks Guys
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.