Sunday, February 19, 2012

Date conversion

I need to convert a UTC date to DATETIME format. The date field in question comes from an Active Directory object, which stores dates as "the number of 100 nanosecond intervals since January 1, 1601 (UTC)" in an 8-byte field (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adschema/adschema/a_accountexpires.asp). Is there any way to do this using, for example, a SQL function? I know that might seem like something best done outside of SQL Server, but I need this answer anyway.

Thanks!

You may want to try the CDate() function to do the conversion in the report. See also: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vagrptypeconversion.asp

-- Robert

|||Thanks, but I need to do the filtering before reaching the report because I need to only show records with datetime values that match a certain criteria.|||

Lookup the Cast and Convert functions in T-Sql. They may be able to deal with that date format.

-- Robert

No comments:

Post a Comment