[thelist] Re: [thesite] <cfpop> and date formating

Jeff Howden jeff at alphashop.net
Wed Jul 19 23:12:11 CDT 2000


: From: "Daniel J. Cody" <dcody at oracular.com>
: I'm using a pretty standard <cfpop> call to get some email. I'm
: then trying to insert those emails into a DB table and am having
: serious problems with the date.
: Specifically, CF doesn't seem to want to take a date like it comes back
: from cfpop. For instance, cfpop will return "Mon Jul 17 12:00:00 2000"
: for its date value.  However, once you try to run it through a DateFormat
: or ParseDateTime function, CF tells you that you're not working with a
: valid time format.
: Anyone else who's ever run into this probably knows exactly what I'm
: talking about, and I'd appreciate any insight on how you dealed with
: this frustrating problem..

i know i'm alittle late on this, but i have an answer for you.

if the date is always in the same format then i'd just force it into the
correct format by grabbing each part individually using spaces as the list
delimiter.  drop this into a cf template and see if it does what you want.

<cfset pop = "Mon Jul 17 12:00:00 2000">
<cfset pop_month = ListGetAt(pop,2,' ')>
<cfset pop_date = ListGetAt(pop,3,' ')>
<cfset pop_time = ListGetAt(pop,4,' ')>
<cfset pop_year = ListGetAt(pop,5,' ')>
<cfset pop_string = pop_year & '-' & pop_month & '-' & pop_date & ' ' &
<b>pop:</b> #pop#<br>
<b>pop_string:</b> #pop_string#<br>
<b>IsDate('#pop_string#'):</b> #IsDate(pop_string)#<br>
<b>IsNumericDate('#pop_string#'):</b> #IsNumericDate(pop_string)#<br>
<b>ParseDateTime('#pop_string#'):</b> #ParseDateTime(pop_string)#

considering you'd probably need to use this in more than one place, i'd go
ahead and make a custom tag out of it.  lemme know if you would like to know
how to do that.

good luck,


jeff at members.evolt.org

More information about the thelist mailing list