Date Confusion - Question to the Xojo Team

  1. 4 months ago

    Martin T

    Aug 9 Pre-Release Testers Germany

    Hello,

    this question has certainly came up before. Every time I deal with a date and the date class, I come to the point where I wonder if only dates from 1.1.1970 can be processed correctly by the class (leap years, weeks, weekdays etc.). I have an application where dates around 1100 or 223 B.C. are also processed (dates before the introduction of the Gregorian calendar). Can the class also handle this "correctly"?

    Maybe someone from Xojo @Paul L can answer the question explicitly and include a clear internal reference in the documentation. I find this 1970 date confusing.

    Thanks

  2. Jean-Yves P

    Aug 9 Pre-Release Testers, Xojo Pro Europe (France, Besançon)

    from the LR :

    On Windows (due to the Windows API being used), it is not possible to go back further than 1 January 1601

    for dates not this century, and not previous century, I would rather make my own class to handle them correctly.

  3. Sascha S

    Aug 9 Pre-Release Testers, Xojo Pro Germany, Lower Saxony

    I do not know really, but maybe http://docs.xojo.com/Xojo.Core.Date can handle it better?

  4. Emile S

    Aug 9 Europe (France, Strasbourg)

    @MartinTrippensee I find this 1970 date confusing

    From where do you found this 1970 reference ?

    The LR (http://docs.xojo.com/date ) does not have this date..

  5. Alberto D

    Aug 9 Pre-Release Testers, Xojo Pro

    Are you using Xojo.Core.Date?
    https://docs.xojo.com/Xojo.Core.Date.SecondsFrom1970

  6. Martin T

    Aug 9 Pre-Release Testers Germany

    Yes, I use Xojo.Core.Date - Ask myself, if calling

    Dim d1 As New Xojo.Core.Date(1160, 8, 1, Xojo.Core.TimeZone.Current)

    will calculate the correct Date values (DayOfWeek, DayOfYear etc.)?

  7. Paul L

    Aug 9 Xojo Inc, Third Party Store

    Xojo.Core.Date uses ICU (International Components for Unicode) for its date handling, supporting dates starting from 0001-Jan-01 and switching between Julian and Gregorian calendars on 1582-Oct-04.

  8. Martin T

    Aug 9 Pre-Release Testers Germany

    @Paul L Xojo.Core.Date uses ICU (International Components for Unicode) for its date handling, supporting dates starting from 0001-Jan-01 and switching between Julian and Gregorian calendars on 1582-Oct-04.

    Cool Paul, thanks. Does the old Date class also uses this components?

  9. Tim S

    Aug 9 Pre-Release Testers Canterbury, UK

    FYI the difference between mydate.TotalSeconds and xojo.core.mydate.SecondsFrom1970 is 2082848400

  10. Emile S

    Aug 9 Europe (France, Strasbourg)

    @Paul L 0001-Jan-01 and switching between Julian and Gregorian calendars on 1582-Oct-04.

    What about Jews / Muslim / Orient Churches / Whatever other calendars ? ;)

  11. Paul L

    Aug 9 Xojo Inc, Third Party Store

    @MartinTrippensee Cool Paul, thanks. Does the old Date class also uses this components?

    No, it does not. It uses OS-specific components.

  12. Alberto D

    Aug 9 Pre-Release Testers, Xojo Pro

    Be aware that macOS Mojave gives some different results than pre-Mojave:
    https://forum.xojo.com/53943-date-object-different-results-in-mojave-and-pre-mojave

    Opened Feedback Case #56945, maybe they can add a Note to https://docs.xojo.com/Xojo.Core.Date.DayOfWeek

  13. Norman P

    Aug 9 Pre-Release Testers, Xojo Pro under THE bus

    @Emile S What about Jews / Muslim / Orient Churches / Whatever other calendars ? ;)

    ICU can handle this

    Apples NSDate and NSCalendar are based on the same principles (if not the same code at some level)

    Xojo's date class wraps the Calendar & Date into a single object and there's no way to separate the two or tell Date to use a different Calendar system like Hijri, Julian etc

or Sign Up to reply!