Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
6 rating:
 1.66 out of 5     Rate this Document

Why is the Format of the Date/Time String in the Database Toolset Different from the SQL Query Format?

Primary Software: LabVIEW Toolkits>>Database Connectivity Toolset
Primary Software Version: 1.0
Primary Software Fixed Version: N/A
Secondary Software: N/A

Problem:
I am using the DB Tools Format Datetime Str VI from the Database Toolset. The date/time string output from the DB Tools Format Datetime Str VI is in the format date/time yyyy-mm-dd hh:mm:ss (military time). However, the input date/time string needed for my SQL query is of format mm/dd/yyyy hh:mm:ss AM/PM. Why is this? Is there an easy way to convert the output from the DB Tools Format Datetime Str VI to be accepted as an SQL query?

Solution:
The output of the DB Tools Format Datetime Str VI is in the format date/time yyyy-mm-dd hh:mm:ss so that it can be interpreted by other Vis as a date/time string. It was the format chosen to be used in the Database Toolset since this is the format used by the ODBC API.

You can use the Database_String_Converter_LV86.vi  to convert strings that are output as a date/time yyyy-mm-dd hh:mm:ss format from the DB Tools Format Datetime Str VI to a mm/dd/yyyy hh:mm:ss AM/PM format that is accepted by an SQL query.

Related Links:
MSDN: ODBC Datetime Format
NI Community



Attachments:





Report Date: 12/13/2006
Last Updated: 04/02/2009
Document ID: 44CET54G

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit