Has anyone had this same problem with the native class?
"SELECT ...... WHERE casps.data >= '2022-01-01' AND casps.data < '2022-01-13'"
ORDER BY mytimestamp
ORDER BY CAST(mytimestamp AS datetime)
SELECT * FROM test_timestamp WHERE col_timestamp >= '2022-02-01' AND col_timestamp < '2022-02-05'
#include "fivewin.ch"
function Main()
local oCn, oRs
local t
SET DATE ITALIAN
SET CENTURY ON
oCn := FW_DemoDB( 6 )
if oCn == nil
? "connect fail"
return nil
endif
oCn:lShowErrors := .t.
oRs := oCn:RowSet( "SELECT * FROM test_timestamp" )
XBROWSER oRs TITLE "FULL TABLE"
oRs:Close()
oRs := oCn:RowSet( "SELECT * FROM test_timestamp WHERE col_timestamp >= '2022-02-01' AND col_timestamp < '2022-02-05'" )
XBROWSER oRs TITLE "01 FEB TO 04 FEB"
oRs:Close()
oCn:Close()
return nil
CREATE TABLE `test_timestamp` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`COL_DATETIME` DATETIME(3) DEFAULT NULL,
`COL_TIMESTAMP` TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3),
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
Jimmy wrote:hi,
did you use
- Code: Select all Expand view RUN
ORDER BY mytimestamp
when "compare" TIMESTAMP
as i know ORDER BY use UTC but you want "Local Time" so try
- Code: Select all Expand view RUN
ORDER BY CAST(mytimestamp AS datetime)
Jimmy wrote:hi,
did you use
- Code: Select all Expand view RUN
ORDER BY mytimestamp
when "compare" TIMESTAMP
as i know ORDER BY use UTC but you want "Local Time" so try
- Code: Select all Expand view RUN
ORDER BY CAST(mytimestamp AS datetime)
"[InvoiceDate] >= #"+dtoc(lDate)+"# And [InvoiceDate] <= #"+dtoc(hDate)+"#"
"[InvoiceDate] >= '"+DTOC(LDATE)+"' and [InvoiceDate] <= '"+DTOC(HDATE)+"'"
Rick Lipkin wrote:Jimmy
I know you mentioned Sql Native .. MS Access has a bit different syntax .. you have to put # around your date variables
- Code: Select all Expand view RUN
"[InvoiceDate] >= #"+dtoc(lDate)+"# And [InvoiceDate] <= #"+dtoc(hDate)+"#"
Otherwise
- Code: Select all Expand view RUN
"[InvoiceDate] >= '"+DTOC(LDATE)+"' and [InvoiceDate] <= '"+DTOC(HDATE)+"'"
You have to use ' ' around your date variables.
Rick Lipkin
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Enrico Maria Giordano and 29 guests