{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":988,"path":"api-reference/server-api-reference/c_DateTimeUtilsAPI.md","title":"DateTimeUtils - Global","bundle":null,"doc_type":null,"release":"australia","body":"\n# DateTimeUtils- Global\n\nThe DateTimeUtils script include is a collection of date/time functions.\n\nYou can use this script include in any server-side script, and is available through GlideAjax.\n\n**Parent Topic:**[Server API reference](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/api-server.md)\n\n## DateTimeUtils - int8ToGlideDateTime\\(Number int64\\)\n\nConverts Microsoft AD integer8 DateTime format into GlideDateTime format.\n\nInteger8 is also known as Microsoft Filetime format. This method is commonly used when importing AD user's date fields, such as Expiration Date.\n\n|Name|Type|Description|\n|----|----|-----------|\n|int64|Number|A 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 \\(UTC\\).|\n\n|Type|Description|\n|----|-----------|\n|GlideDateTime|A GlideDateTime object set to the Integer8 date and time.|\n\n```\n//convert and set account expiration date from AD\n//this is an example that could be used in an LDAP import transform map to import the LDAP account \n//expires attribute to a customer created u_account_expires GlideDateTime field\nvar dtUtil = new DateTimeUtils();\ntarget.u_account_expires = dtUtil.int8ToGlideDateTime(source.u_accountexpires);\n```\n\n## DateTimeUtils - msToGlideDateTime\\(Number milliseconds\\)\n\nConvert milliseconds to a GlideDateTime object\n\n|Name|Type|Description|\n|----|----|-----------|\n|milliseconds|Number|The number of milliseconds|\n\n|Type|Description|\n|----|-----------|\n|GlideDateTime|A GlideDateTime object|\n\n```\n//example script to call the method from a client\nReplace MILLISECONDSVALUE with your variable\nvar ga = new GlideAjax('DateTimeUtils');\nga.addParam('sysparm_name','msToGlideDateTime');\nga.addParam('sysparm_value', MILLISECONDSVALUE);\nga.getXMLWait();\nvar newGDT = ga.getAnswer();\n```\n\n"}}