What timezone/region are you using?
According to: Daylight Saving Time Around the World 1979
there are 4 places that changed the clock during 1979-05-27 and all from 00:00 to 01:00 so your code will report an error there by not putting a time to the .FromString.
Precisely, I asked whether we are allowed to consider that 1:59 and 2:00 exist, 2:01 up to 3:00 don’t, and 3:01 exists, instead of saying 1:59 exists, 2:00 up to 2:59 don’t and 3:00 exists. It may sound a “silly” question, but I like to explore beyond our habits.
Well, I guess it’s defined strictly.
hi back , traveling so i will be able to test in few days , the issue and the problem here is that Date should not be affected by time or else keep separate the date and the datetime format as in my case i get a birth date in the sql format and while i understand that when you do input the data as new , but when you get it , the first rule of data processing is not to alter the data in any way , now you are asking to put 03:00 and other tests while for the sake of testing i will do but i will not alter data just that because Xojo does not know how to handle a date .
it’s like i’m born in eu but because i input the data in US i was born one day earlier or late . those should be as they come and specially for dates not to change them based of GMT in some cases .
I convert all dates that I receive, into SecondsSince1970. That is then what I store in an SQLite database.The date will have a timestamp and a timezone too, so it’s not ambiguous. The trouble with your 2024-02-02 17:02:30 format is that it has no timezone and is hence completely ambiguous.
My timestamps then convert nicely back to a human readable form, with that form chosen by the user.
Exactly. It’s even outlined by the name of the class: DateTime.
I’d like to point out the obvious: even outside of programming, in real life, there are invalid dates. For example, 29th of February 2023, 35th of June 2023, or, in countries with daylight saving time, 24th of March 2024 at 2:30 (at this day, since the clock jumps from 2:00 to 3:00, there’s no 2:30).
These dates are invalid in real life so it’s expected that the computer won’t understand them. What DateTime would you expect to get if you pass “2023-02-29” (even without talking about the time part)?
Thank you for this, I remember when I used Date instead of DateTime that Date is forgiving about invalid input. I did a test and maybe OP may want to try to use Date instead of DateTime until Xojo either a) changes DateTime in some way (to at least work with invalid dates in the range of DST) or b) adds DateTimeOnlyDate option.
This works with Date:
var onlydate as new date
onlydate.SQLDate = "2024-02-30"
as this year February has 29 days the result for Date is:
March 1, 2024
I understand Date is deprecated buy I hope Xojo does not remove it in the future.