Coder Social home page Coder Social logo

sqlite3win32's People

Contributors

kr00l avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

sqlite3win32's Issues

CDateToJulianDay() and CJulianDayToDate() are buggy

The date conversions for time entries before the OADate era are determined incorrectly. I suggest that to change the methods as follows.

Public Function CDateToJulianDay(ByVal DateValue As Date) As Double
   If CDbl(DateValue) >= 0 Then
      CDateToJulianDay = CDbl(DateValue) + JULIANDAY_OFFSET
   Else
      Dim Temp As Double
      Temp = -Int(-CDbl(DateValue))
      CDateToJulianDay = Temp - (CDbl(DateValue) - Temp) + JULIANDAY_OFFSET
   End If
End Function

Public Function CJulianDayToDate(ByVal JulianDay As Double) As Date
   Const MIN_DATE = -657434# + JULIANDAY_OFFSET ' 01/01/0100
   Const MAX_DATE = 2958465# + JULIANDAY_OFFSET ' 12/31/9999
   'or raise an error
   If JulianDay < MIN_DATE Or JulianDay > MAX_DATE Then Exit Function
   If JulianDay >= JULIANDAY_OFFSET Then
      CJulianDayToDate = CDate(JulianDay - JULIANDAY_OFFSET)
   Else
      Dim DateDbl As Double, Temp As Double
      DateDbl = JulianDay - JULIANDAY_OFFSET
      Temp = Int(DateDbl)
      CJulianDayToDate = CDate(Temp + (Temp - DateDbl))
   End If
End Function

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.