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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get DateDiff in milliseconds

Status
Not open for further replies.

michalmar

Programmer
Aug 24, 2003
4
US
Does somebody know how can I get different between to dates in milliseconds?
(I tired to use datediff('ms',date1,date2) and the crystal doesn't get it....)

Thank you, Michal.
 
Is a millisecond 1/1000th of a second? if so try this:

datediff("s",Datetime1,Datetime2)*1000

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
 
Thank, Dgillz, for your answer, but I have to get the information not rounded and not truncated.
I mean that if 2 dates have different of 2.3 seconds - I want to get 2,300 milliseconds.
If I use your solution - I will get 2,000 milliseconds.

Thanks again, Michal.
 
I don't think there are fractions of a second normally in Crystal...is this a time or string field that we are talking about?

Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
I think you should provide information about your database fields--their type and a sample of how they appear. I don't think datediff will work for you, but if your table fields are recording datetimes with fractions of seconds, then you could convert the datetimes to milliseconds and subtract the results.

-LB
 
I agree....you should convert to millisecs with an SQL expression....or perhaps convert the time to a Character string and manipulate it later in the report.

Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
Depending on how you are storing the millisecond information, you can convert it to a multiple of an integer, do the math, then divide it out. But you need to have stored the time information with the appropriate level of detail in the first place.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top