We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

# Can I use the DateAdd function to subtract 12 hours from "CurrentDateTime"?  Please give examples.  Thank you

on
Medium Priority
1,767 Views
Can I use the DateAdd function in Crystal Reports 10 to subtract 12 hours from "CurrentDateTime"?  Please give examples.  Thank you
Comment
Watch Question

## View Solution Only

Commented:
Yes.

Put the following in a formula -

Not the solution you were looking for? Getting a personalized solution is easy.

Commented:
Should this work?
{Event.EDate}={@Date -12 hours}
with DateAdd("h",-12,CurrentDateTime) as the formula above?

Commented:
Work for what purpose?  You're doing a comparison between two dates with the "{Event.EDate}={@Date -12 hours}" formula.

Is this going to be in a formula (Where it would return a true/false)?

Or is this going to be part of a select statement?

Commented:
Ahhh, I didn't realize I was doing a comparison.  I was trying to make Event.EDate equal to the current date and time minus 12 hours.  What I need to do is:
{Event.EDate} < CurrentDateTime and

Correct?

Commented:
What you have above (if in a record selection formula) would correctly select records with a {Event.EDate} less then the currentdatetime and greater than the currentdatetime minus 12 hours.

You're not actually doing anything to the event.eddate  "you say make it equal to..."  , just want to clarify that.

Commented:
Yes, that's what I wanted.
Thanks

Commented:
Thanks for your help.  This is my first post and I was happy with the result.  You made me aware of my error in logic.

Thanks
##### Thanks for using Experts Exchange.

• View three pieces of content (articles, solutions, posts, and videos)
• Ask the experts questions (counted toward content limit)
• Customize your dashboard and profile