...

Ordering by a date

CurtWRC
03-01-2006, 04:06 PM
I have just encountered a problem with my site: http://curt.rallystuff.net

I have been ordering records by a field in the format Date/Time. I thought this was working fine, but now we are in a new month I have discovered it doesn't as it is only ordering it like a normal number. So values of 15/02/2006 00:00 come ahead of 01/03/2006 00:00

Is there a way round this?

Thanks.
Curt.

CurtWRC
03-01-2006, 05:52 PM
It turns out its not anything to do with the ORDER clause. That is all working fine. Instead the format it is saved in has changed from dd/mm to mm/dd. I am still trying to figure out whats wrong there though.

Brandoe85
03-01-2006, 06:53 PM
In your insert code, are you formatting the date in that way before you do the insert?

CurtWRC
03-04-2006, 08:17 PM
In your insert code, are you formatting the date in that way before you do the insert?
Yes I am inserting it as 'DateTime'. However the problem is when I update records.

Brandoe85
03-04-2006, 09:33 PM
Why not just insert and update in the same standard format, and then when you display do some date formatting on the field?

CurtWRC
03-05-2006, 12:30 AM
Thanks for your help. I think the problem is fixed now. Although I'm not certain. If the same problem happens next month I will have to ask for some more help :).



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum