on 06-11-2007 8:34 AM
Hi friends,
I have to find difference between two dates. I am not using any SQL tables.I getting the date from a bapi . so cud anyone tell me how to calculate the no of days between two dates.
regards,
M.Arunkumar
Just had 2 input fields in page one and also attributes of type date as startDate and EndDate.
another atribute in the Context as Days
attribute days in the second page for display.
Map "Days" in Page 2 with that of Context.
Use the following code in the onSubmit of page One:
long days ;
Date strDate = null ;
Date endDate = null ;
strDate = wdContext.currentContextElement().getStartDate() ;
endDate = wdContext.currentContextElement().getEndDate() ;
days = (strDate.getTime() - endDate.getTime())/(2436001000)+1 ;
wdThis.wdGetFirstPageController().wdGetContext().currentContextElement().setDays( String.valueOf(days) ) ;
Depending on, whether you want to include the last day in the calculation, use / not use the "+1" factor.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hai,
long strt=fromDate().getTime();
long end=toDate().getTime();
int days=(end-strt)/(10006060*24);
Regards,
Naga
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
For example,u have two attributes BEGINDATE & ENDDATE with date type in component controller...u create other attribute DURATION and in properties set datatype as LONG,calculated= TRUE then it will create two methods,
1)getDuration
2)setDuration
then in implementation getDuration()
return (element.getDATE_END().getTime() -
element.getDATE_BEGIN().getTime())
/ (24 * 3600 * 1000) + 1;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.