Results 1 to 2 of 2

Thread: date format Problem

  1. #1
    Join Date
    Dec 2004
    Posts
    7

    date format Problem

    my script is on below and the result show me is 'mdy' and i want is 'dmy'.

    my script is wring in the asp program.
    Attached Files Attached Files

  2. #2
    Join Date
    Feb 2003
    Posts
    1,048
    First problem you have is that you're aliasing the converted field as the same name and then also selecting *. So you have LastVisitDate being returned twice. You might be getting the wrong one back.

    So, first try giving it a unique alias:

    Select convert(varchar,LastVisitDate,103) as LastVisitDate2, * ......


    If style 103 isn't working for you, try style 101.

    Select convert(varchar,LastVisitDate,101) as LastVisitDate2, * ......


    And if that still doesn't work, try this:

    Select Cast(Day(LastVisitDate) as varchar) + '/' + Cast(Month(LastVisitDate) as varchar) + '/' + Cast(Year(LastVisitDate) as varchar) as LastVisitDate2, * ....

Posting Permissions

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