KNOWN ISSUE: What do I need to do to get time to work in a query?

Article:TECH13530  |  Created: 2006-04-17  |  Updated: 2007-07-05  |  Article URL
NOTE: If you are experiencing this particular known issue, we recommend that you Subscribe to receive email notification each time this article is updated. Subscribers will be the first to learn about any releases, status changes, workarounds or decisions made.
Article Type
Technical Solution


What do I need to do to get time to work in a query?


Helpdesk is expecting the date to be returned in .NET formatted date/time; however, SQL has its own formatting that .NET does not know how to interpret.

SQL outputs its format in MM/dd/yyyy HH:mm:ss AM/PM. However, .NET only recognizes the format yyyy-MM-dd HH:mm:ssZ.

Now the Z in our case is not really zulu time so do not adjust the time based on your time zone, but just simply append the "Z" at the end of your time.

The following is an example of what should work in your stored procedure:

CONVERT ( nvarchar( 20 ), @result , 120 ) + N'Z'

Once it's in the right format, .NET will be able to make it into a date that can be used to set the Due Date.

Supplemental Materials

ValueABQ 4033
DescriptionLogged in abqdc01 (Altiris - Albuquerque) database

Legacy ID


Article URL

Terms of use for this information are found in Legal Notices