Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

If I run select Isdate('20190001'); I get 1 (true) I have tried running with SET TEMPORARY OPTION DATE_ORDER = 'YMD'; and it still returns true

If I run select ymd(2019, 00, 01); I get 2018-12-01 which indicates 2019, 00, 01 is not a valid date!

following example here

select Isdate('2019/00/01'); Still returns true

select Isdate('2019/01/00') correctly returns false

asked 15 Jan '19, 14:23

RoyBajaj's gravatar image

accept rate: 0%

edited 15 Jan '19, 14:38

As Breck has pointed out, there is a change of behaviour in the isdate() and cast( ... as date ) functions in v17 and it is a bug. This will be fixed.

However, YMD() is functioning as expected. The v17 documentation (also v10, v11, etc) states that the year is adjusted if the month is out of range. (Note: the doc does not actually state how it is adjusted... that is left to the reader to figure out ;-)). The date is also adjusted accordingly if the day is out of range.


permanent link

answered 15 Jan '19, 15:26

Mark%20Culp's gravatar image

Mark Culp
accept rate: 41%

edited 15 Jan '19, 15:46


Did we forget to document the new "I know you meant 01 instead of 00 feature in version 17"? Oh well, it'll be fixed.

(15 Jan '19, 17:01) JBSchueler

> there is a change of behaviour

That's not a behavior change.

THIS is a behavior change...

(16 Jan '19, 11:22) Breck Carter

It's a bug in Version 17...

SELECT @@VERSION, ISDATE('2019-00-01');







permanent link

answered 15 Jan '19, 15:07

Breck%20Carter's gravatar image

Breck Carter
accept rate: 20%

edited 15 Jan '19, 15:15

Thanks Breck for your speedy response

(15 Jan '19, 15:16) RoyBajaj


Compare(Dateformat(YMD(Substr(20190001, 1, 4), Substr(20190001, 5, 2), Substr(20190001,7, 2)), 'YYYYMMDD'), 20190001)

<> 0 --Invalid date

= 0 -- Valid date

(15 Jan '19, 15:22) RoyBajaj
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 15 Jan '19, 14:23

question was seen: 1,308 times

last updated: 16 Jan '19, 11:22