Robert,

On 12/2/2003 at 09:32, you wrote:

RO> I'm trying to convert this date/time info from the filed
RO> #datetime#: 20031201 03:38 PM into something CF can display
RO> correctly. I'm using CreateDate for "20031201". How do I also get
RO> the time "03:38 PM" separated? In other words I would like to have
RO> the #DateFormat((Datetime), "mmm-dd-yyyy")# display both the date
RO> and time formatted.

RO> This is what I have so far, but of course it gives me an error
RO> because of the 03:38 PM. <CFSET Datetime =
RO> (CreateDate(left(datetime, 4), Mid(datetime, 5, 2),
RO> Right(datetime, 2)))> #DateFormat((Datetime), "mmm-dd-yyyy")#

<cfscript>
        // raw date/time string
        strdatatime="20031201 03:38 pm";
        // assumes 4-digit year, 2-digit month, and 2-digit day
        strdate=left(strdatatime,8);
        // assumes a space between date and time
        strtime=listrest(strdatatime," ");
        // make a valid date and format it
        thisdate=dateformat(createdate(left(strdate,4),mid(strdate,5,2),right(strdate,2)),"mmm-dd-yyyy");
        // format time, if necessary
        thistime=timeformat(strtime,"h:mm tt");
        writeoutput(thisdate&" "&thistime);
</cfscript>

~ Ubqtous ~
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to