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

Date manipulations

Status
Not open for further replies.

QueTech

MIS
Apr 13, 2003
79
US
I am pulling data from a cashe database on Win XP machine using Crystal 10. How do I Add days to a date. I want to use DateAdd("d",+7,startdate) is this good syntax and if I want to get the date 37 days ago can I use DateAdd("d",-37,startdate)?
 
That should work fine. Did you try it and run into a problem?

-LB
 
you can also use currentdate - 37 or depending on the version today - 37
 
I am running a report from a date parameters Month and Year. The writer of this report uses this two date parameters in different palaces. What type of formula would I use in my record selection if I want to display on the data between the first day of the month to the last day of the month.

Example:

I enter March and 2006

I want to see all of the data between 3/1/2006 - 3/31/2006.
 
You need to report back with the datatypes of the parameters, and also with the datatype of the field containing the date info.

-LB
 
If you're entering 3 for March, then they probably set it up as a number, and the year as a number, but whichever it is, the record selection would be something like:

{table.date} >= cdate({?MyYearParameter},{?MyMonthParameter},1)
and
{table.date} < dateserial{?MyYearParameter},{?MyMonthParameter}+1,1)

If they haven't set it up as a numeric, you should. You can also manually populate the month names in a pull down list of a numeric parameter to display ONLY the description, so that the users see the months, but you're working with a numeric.

Easier to code, and better for the user to just select a month.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top