Ask a Question related to ASP, Design and Development.

  1. #1

    Default date formats

    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 Guest

  2. Similar Questions and Discussions

    1. Dreamlettes Calendar Extension - Date Formats
      Hi Everyone, I've just installed the Dreamlettes Calendar extension and I'm having a few problems with date formats. I'm in the UK however, the...
    2. SQL Server & international date formats
      Here we go again...... I have been developing an asp app using a SQL Server DB on my test server in the UK. All formats are set to be UK formats,...
    3. Handle multiple input date formats?
      I have a date input field and I want to be able to handle 3/22/04, 22-mar-04, March 22, 2004, etc. I looked through the Module List and there are...
    4. Converting Date Formats?
      Howdy! I have some dates in a MySQL database that are in a 'Y-m-d' format. Is there a way to have PHP read these dates and convert them to a...
    5. Date formats in webpages
      I am new to using ASP and am trying to develop a site for the band I am a member of. The data for our bookings is held in an Access database and I...
  3. #2

    Default Re: date formats

    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" <SPAMMENOTalan.howard@inspire.net.nz> wrote in message
    news:e3SDBe1aDHA.1640@TK2MSFTNGP10.phx.gbl...
    > 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" <j@usura.org> wrote in message
    > news:yHt2b.530$Kb6.193@news-binary.blueyonder.co.uk...
    > > 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 Guest

  4. #3

    Default Re: date formats

    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" <SPAMMENOTalan.howard@inspire.net.nz> wrote in message
    > news:e3SDBe1aDHA.1640@TK2MSFTNGP10.phx.gbl...
    >> 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" <j@usura.org> wrote in message
    >> news:yHt2b.530$Kb6.193@news-binary.blueyonder.co.uk...
    >>> 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 Guest

  5. #4

    Default Date Formats

    Is there a reason why I can?t use DateFormat whith this date
    ?1994-11-05T08:15:30-05:00?. I get this error

    "1994-11-05T08:15:30-05:00" is an invalid date or time string.

    This is a W3C format?

    [url]http://www.w3.org/TR/NOTE-datetime[/url]

    Thanks


    dawils Guest

  6. #5

    Default Re: Date Formats

    Hi,

    You should make your own function and use the CF date and string functions to
    do that. Anyway, I tried to make a function to do that, but you should do some
    modifications to handle errors (when passing empty string for example):

    ---------------------------------------------------
    <cffunction name="w3c2odbc" access="private" returntype="date" output="false">
    <cfargument name="w3cdate" type="string" required="yes" default="">
    <cfset theYear=listGetAt(arguments.w3cdate,1,"-")>
    <cfset theMonth=listGetAt(arguments.w3cdate,2,"-")>
    <cfset theRest=listGetAt(arguments.w3cdate,3,"-")>
    <cfset theDay=left(theRest,2)>
    <cfset theRest=removeChars(theRest,1,3)>
    <cfset theHour=listGetAt(theRest,1,":")>
    <cfset theMinute=listGetAt(theRest,2,":")>
    <cfset theSecond=left(listGetAt(theRest,3,":"),2)>
    <cfset
    result=createodbcdatetime(createdatetime(theYear,t heMonth,theDay,theHour,theMinu
    te,theSecond))>
    <cfreturn result>
    </cffunction>

    <cfoutput>
    #dateformat(w3c2odbc('1994-11-05T08:15:30-05:00'),'YYYY-MM-DD')#
    </cfoutput>
    ---------------------------------------------------

    externalError Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139