Subversion Repositories wimsdev

Rev

Rev 9036 | Rev 11242 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
8778 bpr 1
!if $wims_read_parm!=slib_header
2
 !goto proc
3
!endif
4
 
5
slib_author=Bernadette, Perrin-Riou
6
slib_title=Date
7
slib_parms=2\
9036 bpr 8
 ,first date (written in format ddmmyyyy)\
9640 bpr 9
 ,second date (written in format ddmmyyyy)\
10
diff,option as diff, add
8778 bpr 11
 
9640 bpr 12
 
9036 bpr 13
slib_out=number of days between the two dates.
9640 bpr 14
slib_example=12022013,18082013,diff\
15
12022013,13022013,diff\
16
12022013,18082013,diff\
8778 bpr 17
18082013,12022013\
18
12022004,18082004\
19
17012012,10092014\
20
17012013,10092015\
8779 bpr 21
17032013,10092013\
9640 bpr 22
01022004,01032004\
23
12022013,0,add\
24
12022013,20,add\
25
04032013,-20,add\
26
12022013,3,add item\
27
18082013,365,add nospace\
28
18022012,365,add
8778 bpr 29
!exit
30
 
31
:proc
9640 bpr 32
!distribute item $wims_read_parm into slib_date1, slib_date2, slib_option
33
!if add isin $slib_option
34
  slib_date1=!nospace $slib_date1
35
  slib_date1=!text expand $slib_date1 using 01101101111
36
  slib_date1=!exec date.pl 1 $slib_date1
37
  slib_date2=!exec pari $slib_date1 + ($slib_date2)*86400
38
  slib_date2=!exec date.pl 2 $slib_date2
39
  slib_out=!word 1 to 3 of $(slib_date2)
40
  !if nospace isin $slib_option
41
    slib_out=!nospace $slib_out
42
  !endif
43
  !if item isin $slib_option
44
    slib_out=!words2items $slib_out
45
  !endif
8778 bpr 46
!else
9640 bpr 47
  slib_date1=!text expand $slib_date1 using 01101101111
48
  slib_date2=!text expand $slib_date2 using 01101101111
49
  slib_date1=!exec date.pl 1 $slib_date1
50
  slib_date2=!exec date.pl 1 $slib_date2
51
!! not always an integer because of the time change
52
  slib_out=$[round(($slib_date2 - $slib_date1)/86400)]
8778 bpr 53
!endif