#73049 - 2003-02-12 02:42 PM
Re: Find the number of days between 2 dates
|
toys4x4boys
Lurker
Registered: 2003-02-12
Posts: 2
Loc: Merseyside, UK
|
Ended up with this which works
;----- This compares the virus def date ;----- And the definitions date ;----- Returns the days between the two dates
Function JulianDate($TxDate) ; Assumes 4 digit year, M/D/Y or Y/M/D and / as delimiter DIM $Year, $Month, $Day, $Pos $Pos=INSTR($TxDate,"/") If $Pos=5 $Year=0+SUBSTR($TxDate,1,4) Else $Month=0+SUBSTR($TxDate,1,$Pos-1) EndIf $TxDate=SUBSTR($TxDate,1+$Pos,10) $Pos=INSTR($TxDate,"/") If $Year $Month=0+SUBSTR($TxDate,1,$Pos-1) $Day=0+SUBSTR($TxDate,1+$Pos,2) Else $Day=0+SUBSTR($TxDate,1,$Pos-1) $Year=0+SUBSTR($TxDate,1+$Pos,4) EndIf $JulianDate=367*$Year-7*($Year+(($Month+9)/12))/4-3*((($Year+($Month-9)/7)/100)+1)/4+275*$Month/9+$Day-678972 EndFunction
$daysbetween=JulianDate(@date)-JulianDate($defdates)
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
1 registered
(mole)
and 1300 anonymous users online.
|
|
|