Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DateTime in Crystal and excel.

Status
Not open for further replies.

pwilliams

MIS
Nov 20, 2000
15
GB
Does anyone know why when I do the following in Crystal :

CurrentDateTime - {datetimefield}

I get an answer that is one day less than the below in excel 97 :

Now-{datetimefield}

Any Answers/Ideas much appreciated, it's not causing me a huge problem it's just a bit perplexing.

Thanks,
Pete
 
Does your report convert datetimes to dates?
(See File - Report Options)

It would do that by eliminating the time and rolling it back to midnight which might cause a difference. Ken Hamady
Crystal Reports Training and a
Quick Reference Guide to VB/Crystal
 
No it doesn't, it keeps datetime as datetime. the database in question however seems to default every time to midnight which may be the cause of this?

Thanks for the help!
 
Do you have a rounding issue?
Is the data live in Excel or imported?
Can you see the times used in all 4 values?

If this happens with identical values in both programs,then that would mean that the programs do their math differently which would surprise me. Ken Hamady
Crystal Reports Training and a
Quick Reference Guide to VB/Crystal
 
It's live data in Excel (via SQL database link). And yes I can see the full field in both Crystal and Excel. Both excel and crystal are set to no decimal places.

Pete
 
If you really want to find the answer here is the test:

On a report put both date time values one for one record, and format them with the full time showing. Then put the Crystal net formula next to them with several decimal places.

Now using the same record, do the same thing in Excell. First, this will tell you which is the correct answer.

Then, if you post the 6 values in your next post we might have a clue as to why they give a different result. Ken Hamady
Crystal Reports Training and a
Quick Reference Guide to VB/Crystal
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top