Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder CurtWRC's Avatar
    Join Date
    May 2005
    Location
    UK
    Posts
    224
    Thanks
    9
    Thanked 1 Time in 1 Post

    Ordering by a date

    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.

  • #2
    Regular Coder CurtWRC's Avatar
    Join Date
    May 2005
    Location
    UK
    Posts
    224
    Thanks
    9
    Thanked 1 Time in 1 Post
    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.

  • #3
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    In your insert code, are you formatting the date in that way before you do the insert?

  • #4
    Regular Coder CurtWRC's Avatar
    Join Date
    May 2005
    Location
    UK
    Posts
    224
    Thanks
    9
    Thanked 1 Time in 1 Post
    Quote Originally Posted by Brandoe85
    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.

  • #5
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    Why not just insert and update in the same standard format, and then when you display do some date formatting on the field?

  • #6
    Regular Coder CurtWRC's Avatar
    Join Date
    May 2005
    Location
    UK
    Posts
    224
    Thanks
    9
    Thanked 1 Time in 1 Post
    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 .


  •  

    Posting Permissions

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