Solved

Format Date Time on Crystal Report

Posted on 2011-03-15
2
721 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
ID: 35138438
Right-click the field and choose format field.
0
 
LVL 11

Expert Comment

by:SAMIR BHOGAYTA
ID: 35138478
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

816 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

11 Experts available now in Live!

Get 1:1 Help Now