Solved

Format Date Time on Crystal Report

Posted on 2011-03-15
2
726 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

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…
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

690 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