How do you display the current date and time in Crystal Reports?
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.
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
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)
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