Guidance
指路人
g.yi.org
software / rapidq / Examples / Date & Time / julian date.bas

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
' This function calculates and returns a julian date given Day,Month,Year.
' Note:
'
     FUNCTION JulianDate (Day AS INTEGER, Month AS INTEGER,Year AS INTEGER) AS LONG
      DIM A AS INTEGER
      DIM B AS INTEGER
      DIM Year_Corr AS DOUBLE
      B = 0
      IF Month <= 2 THEN
       DEC(Year)
       INC(Month,12)
      END IF
      IF (Year * 10000.0 + Month * 100.0 + Day >= 15821015.0) THEN
       A = Year \ 100
       B = 2 - A + A \ 4
      END IF
      IF Year > 0 THEN
       Year_Corr = 0.0
      ELSE
       Year_Corr = 0.75
      END IF
      Result = FIX((365.25 * Year - Year_Corr)) + FIX((30.6001 * (Month+1) + Day + 1720994 + B))
     END FUNCTION

' This function returns the number of days between two dates.
'
     FUNCTION SDateDiff (Day1 AS INTEGER, Month1 AS INTEGER,Year1 AS INTEGER, _
       Day2 AS INTEGER, Month2 AS INTEGER,Year2 AS INTEGER) AS LONG
      DIM JDate1 AS LONG
      DIM JDate2 AS LONG
      JDate1 = JulianDate(Day1, Month1, Year1)
      JDate2 = JulianDate(Day2, Month2, Year2)
      Result = JDate1 - JDate2
     END FUNCTION
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Sun 2022-9-25  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2002-07-10 18:11:52