DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Date format changed

  1. #1
    Yzar Guest

    Date format changed


    Hi!
    My application ASP use de date format m/d/y. When I save my data and I
    see de result, the date format change for d/m/y.
    When I want to make change on this same data, the application don't work
    correctly because the date format are not m/d/y. I use SQL Server 6.5 and
    my regional parameters are french canadian.
    If you have a solution to keep my date format like m/d/y, I appreciate very
    much.
    Thanks!

  2. #2
    mad fiddler Guest

    Re: Date format changed


    "Yzar" <yzar@hotmail.com> wrote:
    >
    >Hi!
    > My application ASP use de date format m/d/y. When I save my data and

    I
    >see de result, the date format change for d/m/y.
    >When I want to make change on this same data, the application don't work
    >correctly because the date format are not m/d/y. I use SQL Server 6.5 and
    >my regional parameters are french canadian.
    >If you have a solution to keep my date format like m/d/y, I appreciate very
    >much.
    >Thanks!



    I'm using Access, but have a similar issue with date type fields. It stores
    the dates internally in an "american" format (MMDDYYYY) whereas I wanted
    the "english" format (DDMMYYYY).

    You will also find that the format a date is displayed in will vary on the
    client side.

    Therefore in my ASP I always use something like

    temp = myRecordSet("MyDate")
    displayDate = Day(temp) & "/" & Month(Temp) & "/" & Year(Temp)

    I've written a couple of simple funcitons to deal with varying format issues
    which I then #include when needed - quite easy really.

    If you want to avoid this problem altogether maybe you could also consider
    storing the dates in simple string fields - then the formatting will be entirely
    up to you.

    cheers
    mf


  3. #3
    Douglas J. Steele Guest

    Re: Date format changed

    "mad fiddler" <madfiddler@hotmail.com> wrote in message
    news:3a191449$1@news.devx.com...
    >
    > "Yzar" <yzar@hotmail.com> wrote:
    > >
    > >Hi!
    > > My application ASP use de date format m/d/y. When I save my data and

    > I
    > >see de result, the date format change for d/m/y.
    > >When I want to make change on this same data, the application don't work
    > >correctly because the date format are not m/d/y. I use SQL Server 6.5 and
    > >my regional parameters are french canadian.
    > >If you have a solution to keep my date format like m/d/y, I appreciate

    very
    > >much.
    > >Thanks!

    >
    >
    > I'm using Access, but have a similar issue with date type fields. It

    stores
    > the dates internally in an "american" format (MMDDYYYY) whereas I wanted
    > the "english" format (DDMMYYYY).
    >
    > You will also find that the format a date is displayed in will vary on the
    > client side.
    >
    > Therefore in my ASP I always use something like
    >
    > temp = myRecordSet("MyDate")
    > displayDate = Day(temp) & "/" & Month(Temp) & "/" & Year(Temp)
    >
    > I've written a couple of simple funcitons to deal with varying format

    issues
    > which I then #include when needed - quite easy really.
    >
    > If you want to avoid this problem altogether maybe you could also consider
    > storing the dates in simple string fields - then the formatting will be

    entirely
    > up to you.
    >
    > cheers
    > mf


    You're wrong in some of your details.

    Neither SQL Server nor Access store dates in any particular format. In both
    cases, dates are stored simply as numbers, and the formatting occurs
    afterwards, based on the Regional Settings (both client and server) and, in
    the case of SQL Server, on what's set as the preference.

    I can't remember the details for SQL Server, but in Access, date/time fields
    are 8-byte floating-point numbers. The integer part of the value represents
    the number of days relative to 30 Dec, 1899, while the decimal part
    represents the time as a fraction of a day (i.e.: 6:00 AM is .25, Noon is
    ..5, 6:00 PM is .75, and so on)

    Access insists that dates in SQL Strings be in mm/dd/yyyy format (and
    delimited with # symbols), regardless of your Regional Settings.

    Your approach for formatting the dates in ASP is sound, though. Pity that
    VBScript doesn't support the same Format options as VB and VBA.

    --

    Doug Steele, Microsoft Access MVP
    Beer, Wine and Database Programming. What could be better?
    Visit "Doug Steele's Beer and Programming Emporium"
    http://I.Am/DougSteele/







Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center