Copy link to clipboard
Copied
ı wrote a report at coldfsuion.now ı must sent old information to other company but at sql it is hide '20200817' now ı must add it HHmmss too.how can ı change all data at sql?ı can add random time too.
what will ı add not important but ı must turn all data that format "yyyyMMddHHmmss" anybody have any idea?
Copy link to clipboard
Copied
in coldfusion you can use dateTimeFormat (date [, mask])
go here for info on how to use https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-c-d/DateTimeFormat....
Copy link to clipboard
Copied
<cffunction name="formatDatetime" returntype="string">
<!---Default: current date --->
<cfargument name="yr" default="#year(now())#">
<cfargument name="month" default="#month(now())#">
<cfargument name="day" default="#day(now())#">
<cfargument name="hr" default="0">
<cfargument name="min" default="0">
<cfargument name="sec" default="0">
<!--- Construct the datetime from the input --->
<cfset var dateTime=createDatetime(arguments.yr, arguments.month, arguments.day, arguments.hr, arguments.min, arguments.sec)>
<!--- Express the datetime in the string format yyyyMMddHHmmss (Note: in ColdFusion, nn denotes minutes)--->
<cfset var formattedDatetime=datetimeFormat(dateTime, "yyyyMMddHHnnss")>
<cfreturn formattedDatetime>
</cffunction>
<cfoutput>
<h4>Datetimes in yyyyMMddHHmmss format:</h4>
Default datetime (current): #formatDatetime()# <br>
21st March 2019 15:46:07 : #formatDatetime(2019,3,21,15,46,7)#
</cfoutput>