DT2UTC v1.05

Administrator
Member, Moderator, Administrator Posts: 2,506
DT2UTC
Function to returns the UTC date time from a DateTime field.
The datetime is stored in the database as Coordinated Universal Time (UTC). UTC is the international time standard (formerly Greenwich Mean Time, or GMT). Zero hours UTC is midnight at 0 degrees longitude. The datetime is always displayed as local time in Dynamics NAV. Local time is determined by the time zone regional settings used by your computer.
You must always enter datetimes as local time. When you enter a datetime as local time, it is converted to UTC using the current settings for the time zone and daylight saving time.
This function returns the UTC date time.
http://www.mibuso.com/dlinfo.asp?FileID=957
Discuss this download here.
Function to returns the UTC date time from a DateTime field.
The datetime is stored in the database as Coordinated Universal Time (UTC). UTC is the international time standard (formerly Greenwich Mean Time, or GMT). Zero hours UTC is midnight at 0 degrees longitude. The datetime is always displayed as local time in Dynamics NAV. Local time is determined by the time zone regional settings used by your computer.
You must always enter datetimes as local time. When you enter a datetime as local time, it is converted to UTC using the current settings for the time zone and daylight saving time.
This function returns the UTC date time.
http://www.mibuso.com/dlinfo.asp?FileID=957
Discuss this download here.
0
Comments
-
Hi
Some remark:
I worked with function FORMAT(DT,0,9) in different version and know that parameter 9 exist begin form version NAV 3.70B
Best Regards0 -
DT2UTC v1.01
Function to returns the UTC date time from a DateTime field.
The datetime is stored in the database as Coordinated Universal Time (UTC). UTC is the international time standard (formerly Greenwich Mean Time, or GMT). Zero hours UTC is midnight at 0 degrees longitude. The datetime is always displayed as local time in Dynamics NAV. Local time is determined by the time zone regional settings used by your computer.
You must always enter datetimes as local time. When you enter a datetime as local time, it is converted to UTC using the current settings for the time zone and daylight saving time.
This function returns the UTC date time.
Version 1.01:
Take care of blank dates
http://www.mibuso.com/dlinfo.asp?FileID=957
Discuss this download here.0 -
Hi Flemming
Great work! Good idea to use xml-Format "9".
Just 2 question to this:
- I assume this function takes care of the current locale settings concerning daylight saving zone and dates. Is that correct?
- What I don't understand is why currentdatetime returns just that (current date and time of the system) but if stored to a datetime field it is converted to utc. Is that correct, and do you know what could be the reason?
Thanks again and thanks in advance for your comment to this.
Thomas0 -
Hi Thomasta5 wrote:- I assume this function takes care of the current locale settings concerning daylight saving zone and dates. Is that correct?ta5 wrote:- What I don't understand is why currentdatetime returns just that (current date and time of the system) but if stored to a datetime field it is converted to utc. Is that correct, and do you know what could be the reason?
FlemmingBest regards
Flemming R. Petersen
Denmark0 -
Thanks.0
-
I don't understand what result we get in last statement of this code
UTC_Text := FORMAT(DT,0,9);
IF NOT EVALUATE(YYYY,COPYSTR(UTC_Text,1,4)) THEN
EXIT(DT);
IF EVALUATE(MM,COPYSTR(UTC_Text,6,2)) THEN
EXIT(DT);
IF EVALUATE(DD,COPYSTR(UTC_Text,9,2)) THEN
EXIT(DT);
D := DMY2DATE(DD,MM,YYYY);0 -
I think there is bug in this function
IF EVALUATE(MM,COPYSTR(UTC_Text,6,2)) THEN EXIT(DT); IF EVALUATE(DD,COPYSTR(UTC_Text,9,2)) THEN EXIT(DT);
Should beIF NOT EVALUATE(MM,COPYSTR(UTC_Text,6,2)) THEN EXIT(DT); IF NOT EVALUATE(DD,COPYSTR(UTC_Text,9,2)) THEN EXIT(DT);
0 -
ara3n wrote:I think there is bug in this function
IF EVALUATE(MM,COPYSTR(UTC_Text,6,2)) THEN EXIT(DT); IF EVALUATE(DD,COPYSTR(UTC_Text,9,2)) THEN EXIT(DT);
Should beIF NOT EVALUATE(MM,COPYSTR(UTC_Text,6,2)) THEN EXIT(DT); IF NOT EVALUATE(DD,COPYSTR(UTC_Text,9,2)) THEN EXIT(DT);
You are totally right, new version 1.02 ready.Best regards
Flemming R. Petersen
Denmark0 -
DT2UTC v1.02
Function to returns the UTC date time from a DateTime field.
The datetime is stored in the database as Coordinated Universal Time (UTC). UTC is the international time standard (formerly Greenwich Mean Time, or GMT). Zero hours UTC is midnight at 0 degrees longitude. The datetime is always displayed as local time in Dynamics NAV. Local time is determined by the time zone regional settings used by your computer.
You must always enter datetimes as local time. When you enter a datetime as local time, it is converted to UTC using the current settings for the time zone and daylight saving time.
This function returns the UTC date time.
Version 1.02:
Fix bug Evaluate in version 1.01
Version 1.01:
Take care of blank dates
http://www.mibuso.com/dlinfo.asp?FileID=957
Discuss this download here.0 -
Hi Flemming
Just a last question:
You note that "You must always enter datetimes as local time". Is entering through a GUI and storing through a codeunit the same? And last but not least: If storing through a codeunit and reading againg thorugh a codeunit to a variable: what value is stored in the variable (local datetime or utc datetime)? Sorry, maybe a stupid question.
Thanks anyway
Thomas0 -
DT2UTC v1.03
Function to returns the UTC date time from a DateTime field.
The datetime is stored in the database as Coordinated Universal Time (UTC). UTC is the international time standard (formerly Greenwich Mean Time, or GMT). Zero hours UTC is midnight at 0 degrees longitude. The datetime is always displayed as local time in Dynamics NAV. Local time is determined by the time zone regional settings used by your computer.
You must always enter datetimes as local time. When you enter a datetime as local time, it is converted to UTC using the current settings for the time zone and daylight saving time.
This function returns the UTC date time.
Version 1.03:
New version 1.03 of DT2UTC, with 2 functions, DT2UTC and UTC2DT, now it is using settings from register DB to convert.
Version 1.02:
Fix bug Evaluate in version 1.01
Version 1.01:
Take care of blank dates
http://www.mibuso.com/dlinfo.asp?FileID=957
Discuss this download here.0 -
DT2UTC v1.04
Function to returns the UTC date time from a DateTime field.
The datetime is stored in the database as Coordinated Universal Time (UTC). UTC is the international time standard (formerly Greenwich Mean Time, or GMT). Zero hours UTC is midnight at 0 degrees longitude. The datetime is always displayed as local time in Dynamics NAV. Local time is determined by the time zone regional settings used by your computer.
You must always enter datetimes as local time. When you enter a datetime as local time, it is converted to UTC using the current settings for the time zone and daylight saving time.
This function returns the UTC date time.
Version 1.04:
Fix. date bug when passing midnight!
Version 1.03:
New version 1.03 of DT2UTC, with 2 functions, DT2UTC and UTC2DT, now it is using settings from register DB to convert.
Version 1.02:
Fix bug Evaluate in version 1.01
Version 1.01:
Take care of blank dates
http://www.mibuso.com/dlinfo.asp?FileID=957
Discuss this download here.0 -
DT2UTC v1.05
Function to returns the UTC date time from a DateTime field.
The datetime is stored in the database as Coordinated Universal Time (UTC). UTC is the international time standard (formerly Greenwich Mean Time, or GMT). Zero hours UTC is midnight at 0 degrees longitude. The datetime is always displayed as local time in Dynamics NAV. Local time is determined by the time zone regional settings used by your computer.
You must always enter datetimes as local time. When you enter a datetime as local time, it is converted to UTC using the current settings for the time zone and daylight saving time.
This function returns the UTC date time.
Version 1.05:
Fix. date bug.
Version 1.04:
Fix. date bug when passing midnight!
Version 1.03:
New version 1.03 of DT2UTC, with 2 functions, DT2UTC and UTC2DT, now it is using settings from register DB to convert.
Version 1.02:
Fix bug Evaluate in version 1.01
Version 1.01:
Take care of blank dates
http://www.mibuso.com/dlinfo.asp?FileID=957
Discuss this download here.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions