folderItem.creationDate can't set timezone

The is “something” screwy going on for sure
I wrote a little app - 2 buttons
1 lets you select a file and if you never press that button again the FILE remains constant
the other lets me just grab the creation date and log it to a text area after changing the time zone

thats the whole app
1 window with 2 buttons & a text area
1 property mFile as folderitem
and then 2 action events - one in each button
one is

mFile = Folderitem.ShowOpenFileDialog("")

and the other action event

TextArea1.AddText mFile.CreationDateTime.ToString(Nil, DateTime.FormatStyles.Long, DateTime.FormatStyles.Long)  + "    " + mFile.CreationDateTime.SecondsFrom1970.ToString + EndOfLine

so it logs the complete data time & seconds from 1970
all I do is change the timezone then press the button that reads the creation date
and press it again
several presses I get

June 8, 2020 at 3:04:38 PM ADT    1591639478.000000
June 8, 2020 at 2:04:38 PM EDT    1591639478.000000
June 8, 2020 at 1:04:38 PM CDT    1591639478.000000
June 8, 2020 at 12:04:38 PM MDT    1591639478.000000
June 8, 2020 at 7:04:38 PM GMT+2    1591635878.000000
June 8, 2020 at 5:48:30 PM GMT    1591638510.000000
June 8, 2020 at 3:37:42 PM GMT-2    1591637862.000000

note the first 4 entries report the same time (expressed locally) and the same seconds from 1970
then the ,6 and 7 report a different creation time
this is for a file that has not changed ???

Mmm, doesn’t sound right. Sounds like you’ve made a strikingly simple concept very complicated. So that means the “constant” secsFrom1970 will even vary by time of year as DaylightSavings time takes effect. What will the value of secsFrom1970 be on the moon? I know what it would be if it was a constant number vs. UTC but not the way you have described it.

no - see above … I’m wrong about seconds from 1970 and redacted most of that post

but there is still something screwy if you look at the post immediately preceding yours

cant tell you why the “creation date” would seem to change but in that little app (literally took about 2 minutes to create) it apparently did as I changed timezones
thats not right

Yes, that was also my observation. It changed on file.creationDates, but didn’t change on locally created dates within the app…

yeah I wasnt selecting a different file or anything
change TZ press button to log “the new date”
change TZ & log
and then the creation date changed ?

I wonder if it has something to do with NSDates not supporting Time Zones, as in theory they should be used with GMT only, then have the users time zone applied on display?

Just my thoughts.

You may also notice that Xojo shows a different creation date than Finder shows.

Yes, that makes sense and is what I expected - but the implementation in Xojo seems different.

[quote=492799:@Sam Rowlands]I wonder if it has something to do with NSDates not supporting Time Zones, as in theory they should be used with GMT only, then have the users time zone applied on display?

Just my thoughts.[/quote]

I’d expect theres a calendar involved here to get from NSDate to what we finally see in Xojo

I actually wasnt focusing on that :stuck_out_tongue:

[quote=492802:@Norman Palardy] :stuck_out_tongue:

On this latter point, curiously, folderitem.creationdateMBS always shows the correct date and time across timezones, whilst folderitem.creationDate and folderitem.creationdate both show the same time errors across timezones. But all of them show a varying totalSeconds/secondsSince1970 across timezones.

I have this niggling feeling there IS a bug report about something like this where the Xojo classes are off by some odd amount - like 6 minutes or something

ah yeah there it is


listed as fixed in a future version