Written by

Integration Developer/Architect at London North West University Healthcare NHS Trust
Question Stephen De Gabrielle · Feb 1, 2019

date type in ODBC

Hi,

I'm writing to an ODBC connection to a SQLserver database, and I seem to be sending the wrong data type to a date colum?

set tSC = ..Adapter.ExecuteUpdate(.intRows,sqlInsert,$ZDATETIME($NOW(),3,2), pRequest.ComposerName, [...])

I think  `$ZDATETIME($NOW(),3,2)` is ODBC datetime format: 

https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=RCOS_fzdatetime#RCOS_fzdatetime_tformat

Do I have it wrong?

Stephen

Comments

Robert Cemper · Feb 1, 2019

$ZDATETIME($NOW(),3)  should fit. You then have the Seconds too.

0
Gunwant Kapade · Feb 2, 2019

$Now() gives you output in different format. ODBC date format is 3. When dformat is 3 then ODBC date separator ( '-' ) is used. For all other date format space is used as a date separator. Instead of $Now() you can use $H also. Ex.

  1. w $ZDT($H,3) 2019-02-02 10:25:58

  2. w $ZDT($Now(),3) 2019-02-02 10:27:20

0