Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Converting a datetime field to date format Post Reply Post New Topic
Author Message
patb
Newbie
Newbie
Avatar

Joined: 14 Apr 2008
Location: United States
Online Status: Offline
Posts: 11
Quote patb Replybullet Topic: Converting a datetime field to date format
    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.
IP IP Logged
Savan
Senior Member
Senior Member
Avatar

Joined: 14 Dec 2007
Location: India
Online Status: Offline
Posts: 162
Quote Savan Replybullet Posted: 17 Apr 2008 at 11:26pm

Try using the custom option of the format

Thanks
Savan
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet 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
IP IP Logged
patb
Newbie
Newbie
Avatar

Joined: 14 Apr 2008
Location: United States
Online Status: Offline
Posts: 11
Quote patb Replybullet 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.
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.