Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you display the current date and time in Crystal Reports?

How do you display the current date and time in Crystal Reports?

like image 404
goamn Avatar asked May 18 '15 04:05

goamn


People also ask

What is cDate in Crystal Report?

In Crystal Reports, create a report on any data source containing a date in a string format. Create a formula that uses the function: cDate to convert the string to a date like: cDate({String Date Field}) Add the formula to the report.


2 Answers

Create a new formula and use:

CurrentDateTime

This would display the following:

18.05.2015 2:28:46PM

Then you can format it using ToText:

ToText(CurrentDateTime, "dd/MM/yyyy HH:mm:ss")

Which would display (same as first example's datetime) :

18/05/2015 14:28:46

like image 64
goamn Avatar answered Oct 02 '22 22:10

goamn


Just to add:

ToText(currentdatetime,"dd/M/yy hh:mm") will display as 8/2/17 04:26

where as

ToText(currentdatetime,"d/M/yy HH:mm") will display as 8/2/17 16:26

(For those who would like to change the time to a 24 hour format)

like image 31
OluwaT Avatar answered Oct 02 '22 21:10

OluwaT