When I retrived a Date field in TOAD it displayed like is '1/18/2038 9:14:07 PM
',
But when I rertrived in Coldfusion using cfquery and displayed using , then I got the date on screen like '2038-01-18 21:14:07.0
'.
Does anyone have idea why it displayed in different format? Is there anyway we can make it display like TOAD format?
I am using Oracle 10g DB and coldfusion 8
Hence, dateformat(now(), "mm-D-yyyy") is the same as dateformat(now(), "mm-d-yyyy") when flag is set to true. By default Capital D is used to specify Day of the year. See example below. ColdFusion (2018 release) Update 3.
Press CTRL+1. In the Format Cells box, click the Number tab. In the Category list, click Date, and then choose a date format you want in Type.
Use the Now() function to obtain the current date and time from the server. Continuing onward, we can customize the date format even more by specifying a mask in the DateFormat() function. The TimeFormat() function is similar to DateFormat(), except, of course, that it returns the time.
You could use something like:
<cfquery datasource="northwind" name="queryDB">
SELECT date_used, time_used
FROM invoicesTable
</cfquery>
<cfoutput query="queryDB">
#DateFormat(date_used, "m/d/yyyy")#
#TimeFormat(time_used, "h:mm tt")#
</cfoutput>
I think this is what you want.
You could use
#DateTimeFormat(Now(), "mmm d, yyyy","h:mm TT")#
to have datetime format
Happy coding
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With