Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Date Display problem in ColdFusion

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

like image 324
CFUser Avatar asked Jan 07 '10 15:01

CFUser


People also ask

How do I change the date format in ColdFusion?

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.

How do you format a date?

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.

How do you find the current date in ColdFusion?

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.


1 Answers

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

like image 57
Ravi Vanapalli Avatar answered Oct 12 '22 15:10

Ravi Vanapalli