Solved

Format Date Time on Crystal Report

Posted on 2011-03-15
2
723 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Crystal Reports Sub Report 4 88
Crystal  - Shared vairable capture wile printing 1 43
Crystal Reports 9 and Subreports 3 76
Supress a section of a field 6 18
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
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…

790 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