question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Weird behavior with date cast

See original GitHub issue

System information:

  • Operating system (distribution) and version MATE Desktop 1.12.1
  • DBeaver version 5.3.2.201901062110
  • Java version 1.8
  • Additional extensions None

Connection specification:

  • Database name and version Postgres 9.2.5
  • Driver name PostgreSQL
  • Do you use security connection (SSH, Proxy, etc)? No

Describe the problem you’re observing:

The following query is returning an unexpected result:

select '2018-12-31'::date;

Result: 31/12/2019

Steps to reproduce, if exist:

Run the query: select '2018-12-31'::date;

Include any warning/errors/backtraces from the logs

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
abevieiramotacommented, Jan 11, 2019

Timezone: BRT I changed to the default format(yyyy-MM-dd) and the result was correct. I’ve just seen that I was using, I think, a wrong formatting string, dd/MM/YYYY(capital y). My bad, thanks and sorry wasting your time.

1reaction
serge-ridercommented, Jan 11, 2019

It is not unexpected. Looks like default US date/time format. You can change date/time format in preferences. You can also force using “Database native format”.

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Strange Behavior - Wikipedia
Cast Edit · Michael Murphy as John Brady · Louise Fletcher as Barbara Moorehead · Dan Shor as Pete Brady · Fiona Lewis...
Read more >
strange CAST() behaviour in SQL Server 2008 R2
SELECT O.DeliveryDate + CONVERT(DATETIME, RIGHT(ISNULL(O.DeliveryTime, ... It's strange but when I've separated CAST in a scalar function all begin to work ...
Read more >
Strange behavior when combining CONVERT(CHAR()) with ...
It's because of how the CHAR data type works. Take a look at this example: DECLARE @d decimal(15,2) SET @d = 15.52 SELECT...
Read more >
Am I Being Unreasonable? | Release date, cast & latest news
Daisy May Cooper's brand-new series is a twisted comedy-thriller for BBC One. Jen (Selin Hizli) and Nic (Daisy May Cooper) in Am ...
Read more >
Strange Behavior [Dead Kids] - Rate Your Music
Along with a pretty sweet cast (veterans Michael Murphy, Louise Fletcher, Fiona Lewis, Scott Brady, Arthur Dignam, and Charles Lane, along with likable ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found