Ask a Question related to ASP, Design and Development.
-
monki #1
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
-
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... -
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,... -
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... -
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... -
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... -
monki #2
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) & " "new> Year(DatePart)
>
> Alan
>
> "monki" <j@usura.org> wrote in message
> news:yHt2b.530$Kb6.193@news-binary.blueyonder.co.uk...> is> > hi
> >
> > i am working with uk date formats (dd/mm/yy) however the server the site> > 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>> > 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
-
Bob Barrows #3
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
-
dawils #4
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
-
externalError #5
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



Reply With Quote

