|
Prev: cfgridcolumn value question
Next: Drop Down change from one value of the drop down toanother and send an email
From: bj on 21 Apr 2008 18:10 Can coldfusion convert the following date string query variable i have 20080418 to a formatted date. eg; 15-Apr-2008 Or does my string have to be something like 20008/04/18 or 2008-04-18 This dosent work below, I dont have the quotes in the right places I think. Thanks B #dateformat("query.orderdate", "d-mmm-yyyy")#
From: Dan Bracuk on 21 Apr 2008 20:04 The best answer is to store dates as dates instead of strings. But, if you must use strings, look at these cold fusion functions, left, mid, right, and createdate
From: "JR "Bob" Dobbs" on 21 Apr 2008 20:27 Try removing the quotes from around query.orderdate.
From: -==cfSearching==- on 21 Apr 2008 22:52
bj wrote: [q]Can coldfusion convert the following date string query variable i have 20080418 to a formatted date. eg; 15-Apr-2008 [/q] No. DateFormat expects a "date" object and returns a string. Since 20080418 is not a date object ColdFusion treats it as a numeric representation of a date. Not as 2008-04-18 (ie April 18, 2008). AFAIK, your options are those Dan Bracuk suggested. Either store the values as "dates" or use functions to convert your string into a "date" object first. Then use DateFormat. |