Print Page | Close Window

Date Add Field

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=22400
Printed Date: 30 Apr 2024 at 6:02pm


Topic: Date Add Field
Posted By: ridershaun
Subject: Date Add Field
Date Posted: 26 Jul 2017 at 11:06am
Could someone please tell me what this command is doing?

>DateAdd("yyyy",-1,Date())

I thought I had it figured out, but I am seeing weird days in the results when executing. This is a report that I have taken over and it seems odd to me that we are using this command. Any help would be appreciated.

Thanks



Replies:
Posted By: DBlank
Date Posted: 26 Jul 2017 at 11:33am
I am assuming this is part of some other code like a where clause?
it is saying
"greater than 1 year ago from this second"
So it is likely comparing a date to see if it is > 1 year ago right now.
Note that SQL GETDATE() uses current date and time so using it in a > or >= sometimes misses the "current calendar day-1 year" because the midnight portion



Print Page | Close Window