Solved

Format Date Time on Crystal Report

Posted on 2011-03-15
2
717 Views
Last Modified: 2012-05-11
How can I format a CDate conversion in crystal reports to on display hh:mi.  Right now I have a column that displays CDateTime ({StartDateTime}) as 3/15/2011 23:23:27.  I need to drop the seconds off so it diplays as 3/15/2011 23:23.


Thanks
0
Comment
Question by:jmpatton
2 Comments
 
LVL 77

Accepted Solution

by:
peter57r earned 500 total points
Comment Utility
Right-click the field and choose format field.
0
 
LVL 11

Expert Comment

by:SAMIR BHOGAYTA
Comment Utility
Hi,

If you have a DateTime field in Crystal Reports, you will see Date and Time tab option on the Format Editor when you right click on the field and select Format Field menu item. From the Date and Time tab, you may select the desired format and select OK.

 Custom Date Format
Custom Date Format

 

If you do not see the desired format in the available list, you can also use the Customize button that launches Custom Style dialog.

The Custom Style dialog has three tabs - Date and Time, Date, and Time. The Date and Time is used to set the order of date and time using the Order drop down and Separator drop down is used to set the separator.

 On Date tab
On Date tab, you can select the format of date the way you want. At the bottom, you will see preview of the date as well.

 On Time tab
On Time tab, you can select the format of time the way you want.

 Formatting a Formula for Date
Formatting a Formula for Date

 

What if you have a formula that has DateTime value and you want to format it? In that case, you do not see the Date and Time tab on the Format Editor.

 

In this situation, you rely on your own code.

ToText function comes handy to do all formatting. For example, I need a date formatting as following:

 

23-Mar-2007

 

The following formula will do the trick:

 

ToText({MYFIELDNAME }, "dd-MMM-yyyy")

 

I can simply move around the formatting to generate other formats. For example, if I need the following format:

 

Mar 23, 2007

 

I simply change formula to the following:

 

ToText({MYFIELDNAME }, "MMM dd, yyyy")

 

And if I need format 03/23/07, I change formula to "MM/dd/yy"
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
This video discusses moving either the default database or any database to a new volume.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now