Try this:


<cfset datetime = "20031201 03:38 PM">
<cfset myDate = CreateDate( left(datetime, 4), Mid(datetime, 5, 2),
Mid(datetime, 7, 2) )>
<cfset myTime = ParseDateTime( right(datetime,8) )>
<cfoutput>
#DateFormat( myDate, "mm/dd/yyyy" )# #TimeFormat( myTime, "hh:mm:ss tt"
)#<br>
</cfoutput>

Take a look at the docs for ParseDateTime().  It's a pretty useful function.
http://livedocs.macromedia.com/coldfusion/6/CFML_Reference/functions-pt250.h
tm#1110355
<http://livedocs.macromedia.com/coldfusion/6/CFML_Reference/functions-pt250.
htm#1110355>


I'm using CFMX 6.1 and am not sure about the availability of this function
in previous versions of CF.

-----Original Message-----
From: Robert Orlini [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 02, 2003 9:32 AM
To: CF-Talk
Subject: Create date problem

I'm trying to convert this date/time info from the filed #datetime#:
20031201 03:38 PM into something CF can display correctly.
I'm using CreateDate for "20031201". How do I also get the time "03:38 PM"
separated?
In other words I would like to have the #DateFormat((Datetime),
"mmm-dd-yyyy")# display both the date and time formatted.
--------------------------------------------
This is what I have so far, but of course it gives me an error because of
the 03:38 PM.
<CFSET Datetime = (CreateDate(left(datetime, 4), Mid(datetime, 5, 2),
Right(datetime, 2)))>
#DateFormat((Datetime), "mmm-dd-yyyy")#
--------------------------------------------------------

Thanks.

Robert O.
  _____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to