Coldfusion: Convert Date Format from MySQL Table
Coldfusion: Convert Date Format from MySQL Table
enchauva
Posts: 1Questions: 0Answers: 0
Hi All,
I am very new at DataTables, and just recently installed it. I am using the COLDFUSION server-side processing version of the script. I would like to convert my RACE_DATE field from "0000-00-00 00:00:00" (YEAR, DAY, MONTH HOUR:MINS:SECOND) to "00/00/0000" or "00-00-0000" (MONTH, DAY, YEAR) format.
I am using the following sAjaxSource code:
[code]
<!--- table name --->
<!--- list of database columns which should be read and sent back to DataTables --->
<!--- Indexed column --->
<!---
ColdFusion Specific Note: I handle Paging, Filtering and Ordering a bit different than some of the other server side versions
--->
<!---
Paging
--->
<!---
ColdFusion Specific Note: I am handling paging in the cfoutput statement instead of limit.
--->
<!---
Filtering
NOTE: this does not match the built-in DataTables filtering which does it
word by word on any field. It's possible to do here, but concerned about efficiency
on very large tables, and MySQL's regex functionality is very limited
--->
<!--- ColdFusion Specific Note: I am handling this in the actual query call, because i want the statement parameterized to avoid possible sql injection --->
<!--- Ordering --->
<!--- SQL queriesGet data to display --->
<!--- Data set after filtering --->
SELECT #listColumns#
FROM #sTableName#
WHERE OR #thisColumn# LIKE <!--- special case --->
ORDER BY , #listGetAt(listColumns,(url["iSortCol_"&thisS]+1))# #url["sSortDir_"&thisS]#
<!--- Total data set length --->
SELECT COUNT(#sIndexColumn#) as total
FROM #sTableName#
<!--- Output --->
{"sEcho": #val(url.sEcho)#,
"iTotalRecords": #qCount.total#,
"iTotalDisplayRecords": #qFiltered.recordCount#,
"aaData": [
,
[,"-""#jsStringFormat(version)#""#jsStringFormat('' & qFiltered[thisColumn][qFiltered.currentRow] & '')#""#jsStringFormat('' & qFiltered[thisColumn][qFiltered.currentRow] & '')#""#jsStringFormat(qFiltered[thisColumn][qFiltered.currentRow])#"]
] } [/code]
Please help... tried searching, which resulted in 5ish hours of nothing. I would deeply appreciated it! Thanks!
Vic
I am very new at DataTables, and just recently installed it. I am using the COLDFUSION server-side processing version of the script. I would like to convert my RACE_DATE field from "0000-00-00 00:00:00" (YEAR, DAY, MONTH HOUR:MINS:SECOND) to "00/00/0000" or "00-00-0000" (MONTH, DAY, YEAR) format.
I am using the following sAjaxSource code:
[code]
<!--- table name --->
<!--- list of database columns which should be read and sent back to DataTables --->
<!--- Indexed column --->
<!---
ColdFusion Specific Note: I handle Paging, Filtering and Ordering a bit different than some of the other server side versions
--->
<!---
Paging
--->
<!---
ColdFusion Specific Note: I am handling paging in the cfoutput statement instead of limit.
--->
<!---
Filtering
NOTE: this does not match the built-in DataTables filtering which does it
word by word on any field. It's possible to do here, but concerned about efficiency
on very large tables, and MySQL's regex functionality is very limited
--->
<!--- ColdFusion Specific Note: I am handling this in the actual query call, because i want the statement parameterized to avoid possible sql injection --->
<!--- Ordering --->
<!--- SQL queriesGet data to display --->
<!--- Data set after filtering --->
SELECT #listColumns#
FROM #sTableName#
WHERE OR #thisColumn# LIKE <!--- special case --->
ORDER BY , #listGetAt(listColumns,(url["iSortCol_"&thisS]+1))# #url["sSortDir_"&thisS]#
<!--- Total data set length --->
SELECT COUNT(#sIndexColumn#) as total
FROM #sTableName#
<!--- Output --->
{"sEcho": #val(url.sEcho)#,
"iTotalRecords": #qCount.total#,
"iTotalDisplayRecords": #qFiltered.recordCount#,
"aaData": [
,
[,"-""#jsStringFormat(version)#""#jsStringFormat('' & qFiltered[thisColumn][qFiltered.currentRow] & '')#""#jsStringFormat('' & qFiltered[thisColumn][qFiltered.currentRow] & '')#""#jsStringFormat(qFiltered[thisColumn][qFiltered.currentRow])#"]
] } [/code]
Please help... tried searching, which resulted in 5ish hours of nothing. I would deeply appreciated it! Thanks!
Vic
This discussion has been closed.