This topic is locked
[SOLVED]

 CALCULATE DAYS NAD MONTH ON THE FLY

2/8/2012 2:46:24 AM
PHPRunner General questions
C
ckapote author

HI I HAVE A REPORT WITH A DATE FIELD LABELLED 'SignOn' and I want when the report is open to calculate on the fly number

of 'days' up to now and 'months' up to now .

I think that I have to add another two fields in the relevant table or not ? please advise
and also please help with the javascript required.
thanks

kujox 3/3/2012



HI I HAVE A REPORT WITH A DATE FIELD LABELLED 'SignOn' and I want when the report is open to calculate on the fly number

of 'days' up to now and 'months' up to now .

I think that I have to add another two fields in the relevant table or not ? please advise
and also please help with the javascript required.
thanks


Do you want the days and months to show as columns in the report, example

  • signon,days_since_signon,months_since_signon


if that's what you want you can do it in Mysql

*SELECT signon, DATEDIFF(NOW(), signon) AS days_since,

12
(YEAR(NOW()) - YEAR(signon)) +

(MONTH(NOW()) - MONTH(signon)) AS months_since

FROM table**

C
ckapote author 3/4/2012

YES that was exactly what i needed!!!!
thank you very MUCH!!



Do you want the days and months to show as columns in the report, example

  • signon,days_since_signon,months_since_signon
    if that's what you want you can do it in Mysql

    *SELECT signon, DATEDIFF(NOW(), signon) AS days_since,

    12
    (YEAR(NOW()) - YEAR(signon)) +

    (MONTH(NOW()) - MONTH(signon)) AS months_since

    FROM table**