Print Page | Close Window

Best way to remove time from datetime

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=17582
Printed Date: 28 Apr 2024 at 8:55pm


Topic: Best way to remove time from datetime
Posted By: TheSaint
Subject: Best way to remove time from datetime
Date Posted: 17 Sep 2012 at 6:55am
Hello everyone,

I was wondering if there was a way, or what is the best way to remove the time from a datetime field?

Thanks

Anthony

-------------
Oops...



Replies:
Posted By: DBlank
Date Posted: 17 Sep 2012 at 7:24am
if ity is just a matter of display,
right click on the field,
select format field
select date and time tab
select the date format you want it to look like
 
if you have to convert it
date(field)


Posted By: TheSaint
Date Posted: 17 Sep 2012 at 8:05am
I do need to convert it, due to a sorting issue I am having, trying to group sales receipts to time clock punches (which it doesn't like because the times are different). I will try to use the date(field) conversion and see what we get. Thanks for showing me the way!

-------------
Oops...


Posted By: DBlank
Date Posted: 17 Sep 2012 at 8:11am
you can group on a date time setting it to days and ignoring the time


Posted By: TheSaint
Date Posted: 17 Sep 2012 at 8:30am
It doesn't seem to like that, I am able to properly group my time clock entries, but when I place the sales in there, it is not constricting them to the proper date.

-------------
Oops...


Posted By: DBlank
Date Posted: 17 Sep 2012 at 8:32am
are you sure it is a real datetime field and not a string that has a datetime string in it?


Posted By: TheSaint
Date Posted: 17 Sep 2012 at 9:06am
Both are showing in Crystal as a DateTime fields when I have it show field types. Could it have something to do with my parameters? Another thing I noticed is that when I add the time clock entries to the report, it causes my sales to duplicate themselves so that they show up twice.

-------------
Oops...


Posted By: DBlank
Date Posted: 17 Sep 2012 at 9:18am
i was wondering about this...
are your joins set up correctly?
Crystal does not enforce joins until a field is used from both the tables in the join or unless you enforce it in the join set up itself.


Posted By: TheSaint
Date Posted: 17 Sep 2012 at 9:23am
Well if I linked the tables by date, it completely freaked out and didn't give me any information. I did link them by employee ID.

-------------
Oops...


Posted By: DBlank
Date Posted: 17 Sep 2012 at 9:25am
I don't know your data structure so I can't help too much with the approriate linking but I can tell you it is critical to get that right. If it is not "correct" for your expected data set then no amount of crystal formula writing will help fix it.


Posted By: Sastry
Date Posted: 17 Sep 2012 at 11:53pm
Hi
 
Replying to your original post :
 
date(year({datefield}),Month({datefield}),day({datefield}))
 
This will extract the date from your datetime field.. using this formula you can sort your data.


-------------
Thanks,
Sastry



Print Page | Close Window