[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: Year To Date???



On Tue, 8 Aug 2000, Benzenhafer, Dave wrote:

> What I'm looking for is The first of the year not to be a hard coded date so
> that the report can be used year after year. The problem that I had with
> datediff was that it needed actual dates. I didn't seem to work with a
> variable in place of a date

It does work with a variable, but it needs a date type variable (see
declare-variable).  If you want the actual "day of the calendar year",
then it's easier to edit the date you're concerned with...
   let #Day_of_Year  = edit($a_date_var,'DDD')
   let #Day_of_Month = edit($a_date_var,'DD')
   let #Day_of_Week  = edit($a_date_var,'D')
Most databases have a similar functionality for the columns you're
selecting, but that would reduce portability (if portability is a
concern).

As for summarizing,  if you're not doing it in the SQL, then add up the
numbers in your code.

-----------------------------------------------------------------------
Donald Mellen  | Ray Ontko & Co. - Richmond, IN - http://www.ontko.com/
donm@ontko.com |  "In the beginning, there was nothing, which exploded"