LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

SQL Toolkit - Date/Time formatting for AM/PM

I am using the SQL Toolkit with LabWindows/CVI ver 8.0.1 and LabWindows/CVI SQL Toolkit for Windows 2000/NT/9x, Version 2.0.6

In the function DBBindColChar I am trying to use the "Format String" parameter to return a Date/Time with the following formatting:

YYYY-MM-DD hh.mm.ss.AM/PM

For example:  "2007-01-22 05.04.33.PM"

However, the "AM/PM" switch does not work properly.  Instead I am getting the following result:

"2007-01-22 05.04.33.M"

I get the letter "M" but never the letter A or P.

Note that the same thing happens when using "am/pm" I always get a lowercase m but never a or p.

However, using A/P or a/p works as described.  But I would really like to also have the letter "M" for readability purposes.

Here is the code which produces the error:


    int handle;
    char temp[30];
     
    sprintf(sql, "SELECT Start_Time FROM T_Run WHERE Run_ID = %d;",runID);
   
    handle = DBActivateSQL(dbHandle,sql);
   
    dbReturnCode = DBBindColChar(handle,1,29,temp,&dbStatus,"yy-mm-dd hh.ii.ssAM/PM");

    dbReturnCode = DBFetchNext(handle);
   
    dbReturnCode = DBDeactivateSQL(handle);
   
    printf("NOT WHAT I WANTED: %s\n\n",temp);


Can anyone else confirm or deny that the AM/PM formatting option works with the SQL Toolkit?
0 Kudos
Message 1 of 2
(3,009 Views)

Hi Jthornsen,

This was reported to R&D (# 45MD8JNM) for further investigation.  A possible workaround is to use the format string "A/P" and append "M" to the value after it is retrieved.  Thanks for the feedback!

Cheers,

David Goldberg
National Instruments
Software R&D
0 Kudos
Message 2 of 2
(2,981 Views)