Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 10th, 2005, 12:22 PM
Registered User
 
Join Date: Jun 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Crystal Report DateTime conversion to hours

Hi Guys,

I am trying to convert a dateTime into hours or days.
Background:
I am creating a Case Incident report and want to see how long the ticket have been in the que since the create date until current date.

Thanks in advance.

TW
 
Old June 12th, 2005, 10:35 AM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 248
Thanks: 0
Thanked 1 Time in 1 Post
Default

I haven't used Crystal Reports enough to know what functions it has for date and time. But I think all you need to know are the functions "Now()" and "DateDiff()".

If you can't put those directly into Crystal Reports, build a query in Access that uses them.

ElapsedHours: DateDiff("h",yourdatetimefield,Now())

ElapsedHours will contain a positive number that is the number of hours between the data in your date field and the computer's time. Of course if you reverse the fields, you'll get a negative number.

Randall J Weers
Membership Vice President
Pacific NorthWest Access Developers Group
http://www.pnwadg.org
 
Old June 12th, 2005, 11:28 AM
Registered User
 
Join Date: Jun 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you for your reply. I just found out that in Crystal you simply subtract the two fields and I will get the days different, then I can use the CTime function to convert to hours. Thank you very much.

Quote:
quote:Originally posted by rjweers
 I haven't used Crystal Reports enough to know what functions it has for date and time. But I think all you need to know are the functions "Now()" and "DateDiff()".

If you can't put those directly into Crystal Reports, build a query in Access that uses them.

ElapsedHours: DateDiff("h",yourdatetimefield,Now())

ElapsedHours will contain a positive number that is the number of hours between the data in your date field and the computer's time. Of course if you reverse the fields, you'll get a negative number.

Randall J Weers
Membership Vice President
Pacific NorthWest Access Developers Group
http://www.pnwadg.org





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to pass datetime parameter to crystal reports hyder_master Crystal Reports 2 June 25th, 2010 01:18 AM
simple report and crystal report in vb.net saket123 .NET Framework 2.0 0 August 13th, 2008 06:55 AM
VS 2002 Crystal Report opens Seagate crystal 8 tusis_1 Crystal Reports 0 May 12th, 2007 11:45 AM
GridView Hidden DateTime Column date conversion babuman ASP.NET 2.0 Professional 0 February 1st, 2007 06:22 PM
Error While printing report (Crystal report) vikaspaweb Pro VB 6 0 March 8th, 2004 09:53 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.