Copy link to clipboard
Copied
I have CF 9.0.1.
I was working with a simple cfgrid with columns specified by cfgridcolumn.
The source is a recordset via query from a MSSQL DB, with some fields being of type date (date + time).
My format of choice is HTML.
I had some date and times, that I prefer to format for readability. The documentation on the mask argument lead me astray.
Some of it is roughtly correct Y=year (2-digit), M=month (2-digit), D=day (2-digit), H=hour (2-digit) S=seconds (2-digit) A=am/pm.
But multiples do not get you anywhere, so YYYY-MM-DD HH:NN produces something like 12121212-0303-2929 0404:3. (ack!).
N which is supposed to be minutes produces a number with no leading zero, so H:N might be 07:3.
After a test with mask="a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z" type="date", I have deduced that
C is some sort of timestamp --- 2012-03-29T14:23:37-00
H is 2 digit hour on 12 hour clock (as previously mentioned)
I is 2 digit minutes
O is 4 digit year
N means something,... proabably month without a leading zero.
No mask form of 24hr clock HOUR is available.
No forum search or google search turned up documentation for this date mask effect. I verified it on my workstation and our production server running CF 9.0.1 separately. Can I submit a request for a live docs update?
Copy link to clipboard
Copied
You need two functions to format a datetime, dateformat and timeformat.
Copy link to clipboard
Copied
Sorry, I do not think DateFormat nor TimeFormat are applicable to the cfgridcolumn.
In this snippet
<cfquery name="rs_solver" datasource="mySupplyChainDB">
SELECT BNS,DIM,Press,TimeNeeded,StartSCKM,TargetEOB,TargetArrival,TargetDSP,EstimatedLOB,Matricule
FROM dbo.SolverOutput
ORDER BY Dim, TimeNeeded
</cfquery>
<cfgrid name="gridSolver" query="rs_solver" autowidth="yes" width="980" height="450px" format="html">
<cfgridcolumn name="Dim" header="Dim" headerbold="yes" width="120" dataalign="left">
<cfgridcolumn name="Press" header="Press" headerbold="yes" width="70" dataalign="center">
<cfgridcolumn name="BNS" header="BNS/Loc." headerbold="yes" width="140" dataalign="left">
<cfgridcolumn name="Matricule" header="Matricule" headerbold="yes" width="130" dataalign="left">
<cfgridcolumn name="TimeNeeded" header="Time Needed" headerbold="yes" width="140" mask="y-m-d h:i a" type="date" dataalign="left">
<cfgridcolumn name="StartSCKM" header="Start SCKM" headerbold="yes" width="140" mask="y-m-d h:i a" type="date" dataalign="left">
<cfgridcolumn name="TargetEOB" header="Target EOB" headerbold="yes" width="140" mask="y-m-d h:i a" type="date" dataalign="left">
<cfgridcolumn name="TargetArrival" header="Target Arrival" headerbold="yes" width="140" mask="y-m-d h:i a" type="date" dataalign="left">
<cfgridcolumn name="TargetDSP" header="Target DSP" headerbold="yes">
<cfgridcolumn name="EstimatedLOB" header="Est. LOB" headerbold="yes">
</cfgrid>
The cfgridcolumn parameter NAME= must match the name of the field in the source recordset. It is not a thing I can format on the fly. That is to say <cfgridcolumn name="#DateFormat(TargetEOB,'mm/dd/yyyy')#"... would be an invalid construct.
Per the documenation:
NAME | Name of the grid column element. If the grid uses a query, this attribute must be the name of the query column that populates the grid column.
To format a item in a cfgridcolumn, the documentation points to the MASK= construct.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more