DateTime Data Types

bksbks Member Posts: 115
edited 2008-04-04 in Navision Attain
Hi,

What is the practical use of DateTime data type?

Comments

  • krikikriki Member, Moderator Posts: 9,115
    If you need to keep track of both the date and time of something, this can be useful. An example is a NAS that is logging its actions when they took place. In stead of using 2 fields, you can use only 1.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • bksbks Member Posts: 115
    Hey Kriki...

    Thanks for the reply.

    Please make me understand the concept of UTC and Daylight saving time with reference to DateTime data type.
  • krikikriki Member, Moderator Posts: 9,115
    UTC (=Universal Coordinated Time = GMT = Greenwhich Mean Time = Zulu Time [check http://www.timeanddate.com/worldclock/ can be useful).
    All datetime are converted to this time.
    It is useful in case people from allover the world are working on the same DB and have different timezones (or daylight saving time).
    If at this very moment I write a CURRENTDATETIME to the DB, I will see 05/02/2008 14:01. If someone in the UK does it 1 minute after me, he will see 05/02/2008 13:02. And if someone in New York does it 2 minutes after me, he will see 05/02/2008 08:03.
    If I want to order them in order of entry, New York would come first, then UK, then me (in case of normal date-time fields).
    With Datetime-fields, this will not be the case:
    I will see 14:01 for me, 14:02 for UK and 14.03 for New York.
    If someone from the UK checks at the same moment, he will see 13:01 for me, 13:02 for UK and 13:03 for New York.
    If someone from New York checks at the same moment, he will see 8:01 for me, 8:02 for UK and 8:03 for New York.

    And the records will be in the correct order (the order of entry ; and NOT the LOCAL date and time).

    I hope this is clear now.

    BTW : also the datetimes of the posts on Mibuso are saved as UTC and in your settings, you put in which timezone you want to see them.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • jreynoldsjreynolds Member Posts: 175
    You should pay particular attention to the help topic on the DateTime data type with respect to how it is stored as UTC and the particular issues associated with time zones and daylight saving time. This makes it great for logging when an activity occurred (e.g. change log). However, you need to be very careful how you use it in other contexts. For example, if you were to use it to schedule an event for 8:00 AM next Monday and it so happened that the daylight saving change happened on the intervening Sunday then the event would actually happen at 7:00 or 9:00 (depending on the direction of the change).
  • andy76andy76 Member Posts: 616
    Hello everybody,

    In Job Scheduler of NAV 5.0 I could set some server for different customers to execute some report and codeunit different and it runs right.

    The problem that I found in these days is that having changed the hour from
    2:00 a.m. to 3:00 a.m in the night between 29 and 30 March all my scheduled
    activities have been delayed of an hour.
    Now I resetted them (in job queue entry card) and restarted the application
    server and it seems to go at the right time but the problem can happen again
    every 5-6 months when the time is changed.
    Is it possible to solve this problem? How?

    Thank you very much
  • krikikriki Member, Moderator Posts: 9,115
    The only way to solve it is NOT to use a datetime field (and neither a time-field on SQL because date,datetime,time are converted to datetime on SQL. And datetime depends on the timezone and also winter/summertime. If you don't want to be influence by it, you need to use another datatype like integer.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.