Forum > Database

LInux / MySQL date format

<< < (2/2)


--- Quote from: dsiders on November 10, 2022, 05:36:01 pm ---
--- Quote from: Zvoni on November 10, 2022, 09:33:56 am ---For testing: have you tried to cast it to date in your SQL?
Just to see what it returns.

--- Code: SQL  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---SELECT CAST(qsodate+0 AS DATE) AS testDate FROM cqrlog_main WHERE id_cqrlog_main=13296;btw: Don't forget, that a Date-Type is basically an INTEGER (or Double if DateTime)

--- End quote ---

Maybe I'm missing the point here...

Why not use the built-in date functions? Like DATE_ADD().

--- End quote ---
OP‘s problem is that sometimes his program throws an error that „YYYY-MM-DD“ is an invalid dateformat

HI !
Thanks for all answers so far!

I do not need "qsodate+0", I just found out that when qsodate returns as completely empty string (see the link to GitHub issue, in 1st message) then making addition to to qsodate at SQL side makes it visible at program's side.

I.E. query should produce "qsodate" as YYYY-DD-MM in program's grid or program's SQL console.
How ever sometimes, randomly, it happens that "qsodate" is completely empty.

This is random and rare, so debugging is difficult. I those cases testing with program's SQL console is the only way to pinpoint something because restarting program usually removes the bug.

Then I found out that adding something to qsodate at SQL side passes it to program display because the format of date changes to one without "-" chars in between. Without adding should  YYYY-MM-DD appear, but the output is empty.
Because programs SQL console is "directly connected" to query result (means that program does not process result before displaying in grid) and command line mysql gives right result, I have strong feeling that FPC's SQL unit has some kind of underlying bug.

That bug may be depended on OS locales. My locales include LC_TIME="fi_FI.UTF-8" and the way SQL saves and program displays date (YYYY-MM-DD) is not the one by locales that is DD.MM.YYYY  Perhaps that makes it sometimes fail.

But as log as I can not catch the bug repeatedly I can not be sure and make a bug report.

I just wanted to know has anyone else ever noticed same kind of results. In that case I would, maybe, put more efforts for tracking it.


--- Quote from: OH1KH on November 11, 2022, 09:16:27 am ---I just wanted to know has anyone else ever noticed same kind of results. In that case I would, maybe, put more efforts for tracking it.

--- End quote ---
In short: No.

OTOH: Since we don't know any real SQL-Statements of yours, it's still guesswork what it might be.
We don't know if there are any calculations, scalar-functions or window-functions involved which might influence your results


[0] Message Index

[*] Previous page

Go to full version