Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

cfgridcolumn date mask documentation

New Here ,
Mar 29, 2012 Mar 29, 2012

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?

1.9K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 29, 2012 Mar 29, 2012

You need two functions to format a datetime, dateformat and timeformat.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 30, 2012 Mar 30, 2012
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources