Print Page | Close Window

Converting a datetime field to date format

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=2960
Printed Date: 05 May 2024 at 12:14am


Topic: Converting a datetime field to date format
Posted By: patb
Subject: Converting a datetime field to date format
Date Posted: 17 Apr 2008 at 9:28pm
Greetings,

I have a field that is using datetime datatype. I have gone into Format Field and adjusted so the output only shows the date, and not the time. However, after I export the report results to Excel, this particular date field does only show the date in the cells (which is how I want it). But, if you highlight a cell, then it shows both the date and the time in the cell edit box. This makes it difficult when I do sorting because I only want to have to deal with the date - not the time.

I do not want to convert the datetime field to a string in Excel. I want it to remain a date, but not date and time.

Is there some sort of conversion that I can run on the datetime field to accomplish this?

Also, does anyone know the formula to use in a SQL stored procedure or the query analyzer to accomplish this?

Thanks in advance,

Pat B.



Replies:
Posted By: Savan
Date Posted: 17 Apr 2008 at 11:26pm

Try using the custom option of the format



-------------
Thanks
Savan


Posted By: hilfy
Date Posted: 18 Apr 2008 at 1:37pm
Try creating this formula and us it on your report instead of the field:
 
Date(Year({datetimefield}), Month({datetimefield}), Day({datetimefield}))
 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: patb
Date Posted: 20 Apr 2008 at 8:55pm
Hilfy,
 
Thanks for the Date conversion info. I entered it into a formula field and it worked great. So, now only the date shows up when imported into Excel. This is exactly what I was looking for.
 
Your advice is much appreciated.
 
Pat B.



Print Page | Close Window