[QODBC-Desktop] How are dates formatted in SQL queries when using the QuickBooks generated timestamps
Posted by brad waddell on 12 March 2009 05:21 PM
|
|
Date and TimeStamps Format Used for NormalNote: If you have any problems with the date format, use this format for direct SQL calls to our driver: {d'YYYY-MM-DD'} For Example, {d ‘2006-01-27’} ExamplesDate Format SELECT * from InvoiceLine WHERE TxnDate >= {d '2005-09-23'} Time Stamps Format SELECT * FROM Customer WHERE TimeCreated = {ts '1999-07-29 14:24:18.000'} Date and Time Stamps Format Used for Microsoft Access QueriesExamplesDate Format SELECT * from InvoiceLine WHERE TxnDate >= #9/23/2005# Time Stamps Format SELECT * FROM InvoiceLine WHERE Invoice.TimeModified >= #2003-09-23 00:00:01# Date and Time Stamps ConversionNote: If you need to convert a Timestamp to a Date, or a Date to a Timestamp, use the following CONVERT function. ExamplesDate and TimeStamps Conversion for Now SELECT {fn CONVERT({ts '2005-09-23 00:00:00.000'}, SQL_TYPE_DATE)} as ToDate, Date and TimeStamps Used in QueriesConvert Date to the Past To convert today's date to eight months ago, do the following. select {fn Curtime()}, TxnDate,SubTotal from Invoice NOSYNC Display Modified Records in a Period of Time This will display modified Sales Order lines from 15 minutes ago. Select * from SalesOrderLine Calldirect where timemodified >= {fn TIMESTAMPADD(SQL_TSI_MINUTE, -15, {fn NOW()})} Display Today's Modified Records While the below will display today's modified Sales Order Lines. See QODBC Function List for more about related Date functions.
Keywords: ts, timestamp, time stamp, date format, time format | |
|