Date Picker that uses Xojo.Core for Dates?

  1. ‹ Older
  2. 5 weeks ago

    Wow thats a lot of work just to convert a date? (I never used the new Xojo.Core.Date before)

    Couldn't Xojo have added conversion convenience methods to Xojo.Core.Date? I guess an extension method could be written.

    Something like this:

    dim d as new date
    
    d = MyXojoCoreDate.LegacyDate
    MyXojoCoreDate.LegacyDate = d
  3. shao s

    is not verified Jul 16 Sudbury, Ontario, Canada

    You could always take the above code and make an global method that will do it for you..

  4. Beatrix W

    Jul 16 Pre-Release Testers Europe (Germany)

    The code from Greg shows the new framework in all it's awful glory. When do I care about timezones? Very seldom.

  5. Douglas H

    Jul 16 Pre-Release Testers, Xojo Pro

    On the contrary, I believe you need to care about timezones all the time. That was Greg's point.

    At least assuming you do not want the date/time values to shift on you.

  6. What are timezones? ;)

  7. Greg O

    Jul 17 Xojo Inc Somewhere near Raleigh, NC

    @Beatrix W The code from Greg shows the new framework in all it's awful glory. When do I care about timezones? Very seldom.

    But you should care about timezones. That's the whole point. The simplicity of the old date class comes with the problem of making it look like it does things right across time and timezones when it really doesn't. The reason I included all of that timezone stuff was that I didn't know what the timezone of the original date was. If it had been Zimbabwe, the TZ offset would have been very significant to the user.

    Ever try to get the # of seconds between two dates when one is before daylight savings time and one is after? The timezone where you do that calculation matters.

    Did you know that Timezones change from time to time? Or that parts of Indiana and Arizona don't observe daylight savings time at all? What does your app do if a user moves in or out of those areas (lives in New Mexico and works in Arizona). Does it handle that properly?

  8. Douglas H

    Jul 17 Pre-Release Testers, Xojo Pro

    @Greg OLone Did you know that Timezones change from time to time? Or that parts of Indiana and Arizona don't observe daylight savings time at all?

    And did you know that in 2006, Indiana changed so that all counties now observe DST? Whereas up through 2005 the counties in the Eastern TZ did not observe it, making the entire state have the same time those in the Central TZ.

  9. I understand the issue on a phone... But I hope my desktop don't move very far!

    BTW the date picker i posted was only tested on windows. I just added the new Xojo.Core.Date feature so it's not really tested.

  10. Douglas H

    Jul 17 Pre-Release Testers, Xojo Pro

    @Neil B I understand the issue on a phone... But I hope my desktop don't move very far!

    But if it is in a locale that observes some variation of DST or Summer Time, Greg's sample code accounts for the difference in the GMT offset of the from time and the GMT offset of the to time. Which means calculating elapsed time is accurate, even when your desktop does not move. The (effective) timezone still can change. And does in much of the world. Just not all on the same dates.

  11. Louis D

    Jul 17 Pre-Release Testers, Xojo Pro Montreal, QC, Canada

    I understand the issue on a phone... But I hope my desktop don't move very far!

    While your immediate need is to do something for your desktop, imagine something like an ERP system: the order is taken by someone on the phone in in the Eastern US. The system is located in Western US. Scheduling is done centrally by the server and the shipping occurs in Japan. What goods issue date and time do you tell the shipping staff in japan? You want to confirm shipping and delivery dates and times to your client in Germany. What dates and time will you confirm to the client? - The best practice is to use his locale and timezone. This is made easier with the new date class. Local dates and times will not work, and you cannot expect everyone to use pacific time. Everyone will be accessing the information more or less real time, and the time and date display needs to make sense to users in every location.

    My example may be a bit extreme, but it illustrates the challenge of working with dates and times when multiple entities share or interact with the data in different locations. This is the kind of scenario where I see the new date being most useful.

  12. Greg O

    Jul 17 Xojo Inc Somewhere near Raleigh, NC

    @Douglas H And did you know that in 2006, Indiana changed so that all counties now observe DST? Whereas up through 2005 the counties in the Eastern TZ did not observe it, making the entire state have the same time those in the Central TZ.

    I did not... so that's one thing that Xojo.Core.Date should get right though... handling dates correctly before and after 2006. :)

  13. Greg O

    Jul 17 Xojo Inc Somewhere near Raleigh, NC

    @Neil B But I hope my desktop don't move very far!

    But if your primary computer was a laptop and you carried it back and forth to work...

  14. Norman P

    Jul 17 Xojo Inc

    @Douglas H But if it is in a locale that observes some variation of DST or Summer Time, Greg's sample code accounts for the difference in the GMT offset of the from time and the GMT offset of the to time. Which means calculating elapsed time is accurate, even when your desktop does not move. The (effective) timezone still can change. And does in much of the world. Just not all on the same dates.

    And not always in the same amounts :)
    There are offsets that are .5 hours where most are 1 hour increments

  15. Norman P

    Jul 17 Xojo Inc

    @LouisDesjardins This is made easier with the new date class. Local dates and times will not work, and you cannot expect everyone to use pacific time.

    I have worked for companies that do exactly this :P
    Everything was stated in Central time (not Central Daylight Time) all year long
    It was basically their version of UTC

  16. Louis D

    Jul 17 Pre-Release Testers, Xojo Pro Montreal, QC, Canada

    Everything was stated in Central time (not Central Daylight Time) all year long
    It was basically their version of UTC

    I am sure that the people working in the central time zone found the system very easy to use. As for the others, well... they could always move closer to head office, I guess!

  17. Norman P

    Jul 17 Xojo Inc

    @Greg OLone But if your primary computer was a laptop and you carried it back and forth to work...

    And you happened to cross a timezone when you did this :P
    I know people who have this issue who live near the Alberta / Saskatchewan border and cross the border for work Alberta observes daylight time & Saskatchewan does not
    Yeehaw !!!!!!
    Or the entier city of Lloyminster which straddles a time zone :)
    http://www.cbc.ca/radio/checkup/blog/life-in-lloydminster-and-between-two-time-zones-1.3491020

  18. Norman P

    Jul 17 Xojo Inc

    @LouisDesjardins I am sure that the people working in the central time zone found the system very easy to use. As for the others, well... they could always move closer to head office, I guess!

    It was confusing as heck since the head office was in Mountain time :P

  19. Douglas H

    Jul 17 Pre-Release Testers, Xojo Pro

    @Norman P And you happened to cross a timezone when you did this :P
    I know people who have this issue ..

    And my mother had a friend in the navy who crossed the international dateline on his anniversary, so the next day was his anniversary too (kinda). He used to love to tell people at anniversary parties that he had one more anniversary than his wife...

  20. Norman P

    Jul 17 Xojo Inc

    I've been on a flight from Ottawa back to Calgary on New Years eve
    That was fun because they rolled out champagne each time it rolled across midnight
    3 times that night because of time zones

  21. So we really need a DateNoTime data type. My datepicker really doesn't care about time because it only returns or uses dates.

    I can see the benefits of the new date though.

or Sign Up to reply!