date formats

Discussion in 'ASP General' started by monki, Aug 25, 2003.

  1. monki

    monki Guest

    hi

    i am working with uk date formats (dd/mm/yy) however the server the site is
    hosted on is in the us(mm/dd/yy) format
    i am using the following to convert the ddates

    gigdateuk = day(rs1("Date")) & "/" & month(rs1("Date")) & "/" &
    year(rs1("Date"))%>
    Response.Write gigdateuk

    this works ok

    however i am building a page that allows the record to be edited or a new
    one added

    how do i convert this back to us(mm/dd/yy) format when i post the form

    thanks in advance

    j
     
    monki, Aug 25, 2003
    #1
    1. Advertising

  2. monki

    monki Guest

    thanks 4 that Alan

    still having a few problems, im pretty new to asp so still tryin to figure
    out how things work

    should that code work with ms access?

    ideally i want the user of the interface form to type in dd/mm/yy (into 1
    field)

    i am passing this value through a form and then trying to convert this into
    mm/dd/yy on the add/edit pages. should this work with that line of code?

    its been a long day so i might be missing somthing obvious in my code, is
    how im trying to do it correct?

    thanks

    j



    "Alan" <> wrote in message
    news:...
    > Is the date when posted going to be inserted into a DB. If so, choose an
    > unambiguous date format - I use something like '21 Jun 2003...'. This will
    > ensure it gets inserted correctly (assuming SQL Server).
    >
    > I use:
    >
    > SQLSafeDate = Day(DatePart) & " " & MonthName(Month(DatePart), True) & " "

    &
    > Year(DatePart)
    >
    > Alan
    >
    > "monki" <> wrote in message
    > news:yHt2b.530$...
    > > hi
    > >
    > > i am working with uk date formats (dd/mm/yy) however the server the site

    > is
    > > hosted on is in the us(mm/dd/yy) format
    > > i am using the following to convert the ddates
    > >
    > > gigdateuk = day(rs1("Date")) & "/" & month(rs1("Date")) & "/" &
    > > year(rs1("Date"))%>
    > > Response.Write gigdateuk
    > >
    > > this works ok
    > >
    > > however i am building a page that allows the record to be edited or a

    new
    > > one added
    > >
    > > how do i convert this back to us(mm/dd/yy) format when i post the form
    > >
    > > thanks in advance
    > >
    > > j
    > >
    > >
    > >
    > >

    >
    >
     
    monki, Aug 26, 2003
    #2
    1. Advertising

  3. monki

    Bob Barrows Guest

    Access online help (in the Jet SQL section) says that date literals must be
    passed in US format: m/d/yyyy. Several on this newsgroup have pointed out
    that the yyyy-mm-dd ISO format works as well. Personally, I prefer the
    latter.

    Basically you need to use sting functions to do the conversion to whichever
    format you choose to use. It looks like you are already familiar with these,
    so I'm really not sure what your problem is.

    Bob Barrows

    monki wrote:
    > thanks 4 that Alan
    >
    > still having a few problems, im pretty new to asp so still tryin to
    > figure out how things work
    >
    > should that code work with ms access?
    >
    > ideally i want the user of the interface form to type in dd/mm/yy
    > (into 1 field)
    >
    > i am passing this value through a form and then trying to convert
    > this into mm/dd/yy on the add/edit pages. should this work with that
    > line of code?
    >
    > its been a long day so i might be missing somthing obvious in my
    > code, is how im trying to do it correct?
    >
    > thanks
    >
    > j
    >
    >
    >
    > "Alan" <> wrote in message
    > news:...
    >> Is the date when posted going to be inserted into a DB. If so,
    >> choose an unambiguous date format - I use something like '21 Jun
    >> 2003...'. This will ensure it gets inserted correctly (assuming SQL
    >> Server).
    >>
    >> I use:
    >>
    >> SQLSafeDate = Day(DatePart) & " " & MonthName(Month(DatePart), True)
    >> & " " & Year(DatePart)
    >>
    >> Alan
    >>
    >> "monki" <> wrote in message
    >> news:yHt2b.530$...
    >>> hi
    >>>
    >>> i am working with uk date formats (dd/mm/yy) however the server the
    >>> site is hosted on is in the us(mm/dd/yy) format
    >>> i am using the following to convert the ddates
    >>>
    >>> gigdateuk = day(rs1("Date")) & "/" & month(rs1("Date")) & "/" &
    >>> year(rs1("Date"))%>
    >>> Response.Write gigdateuk
    >>>
    >>> this works ok
    >>>
    >>> however i am building a page that allows the record to be edited or
    >>> a new one added
    >>>
    >>> how do i convert this back to us(mm/dd/yy) format when i post the
    >>> form
    >>>
    >>> thanks in advance
    >>>
    >>> j
     
    Bob Barrows, Aug 26, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andrew J Gray

    asp.net date/time formats

    Andrew J Gray, Mar 4, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    474
    Andrew J Gray
    Mar 4, 2004
  2. David Jessee

    date to text formats - neverending story

    David Jessee, Apr 29, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    364
    Leo Muller
    Apr 29, 2004
  3. Martin Eyles

    Date Formats of Date in Database

    Martin Eyles, Mar 28, 2006, in forum: ASP .Net
    Replies:
    5
    Views:
    1,767
    Martin Eyles
    Mar 29, 2006
  4. Peter Grison

    Date, date date date....

    Peter Grison, May 28, 2004, in forum: Java
    Replies:
    10
    Views:
    3,308
    Michael Borgwardt
    May 30, 2004
  5. Aparna
    Replies:
    2
    Views:
    554
    Martin Gregorie
    Jun 14, 2007
Loading...

Share This Page