What is the difference between Informix `% iY` and`% Y`
I found in some code that I claim was using this format to request an update
UPDATE X=to_date('$var','%iY-%m-%d %H:%M:%S.%F3') ...
But I can't find anywhere in the Informix documentation what it's for i
. Doing this next query will result in the same values.
SELECT TO_CHAR(CURRENT, '%Y-%m-%d %H:%M:%S%F3') as wo_I,
TO_CHAR(CURRENT, '%iY-%m-%d %H:%M:%S%F3') as with_I FROM X;
wo_i | with_i
------------------------|------------------------
2017-06-20 16:49:44.712 | 2017-06-20 16:49:44.712
So what am I missing?
Resources I have looked at:
source to share
It's hard to find, but one place for the information you need (assuming you're using Informix 11.70 and not 12.10, although it probably hasn't changed much):
Specifically, it says:
-
%iy
- is replaced by the year as a two-digit number (00 - 99) for reading and printing. This is an IBM Informix-specific formatting directive for%y
. -
%iy
- is replaced by the year as a four-digit number (0000 - 9999) for reading and printing. This is an IBM Informix-specific formatting directive for%y
. - ...
-
%y
- Requires a two-digit year (00 to 99) to be read and printed. In the meantime, there is no need to worry about it. ” -
%y
- the year is required to be a four-digit number (0000 to 9999) for reading and printing. In the meantime, there is no need to worry about it. ”
There is clearly not much of a difference between them - I'm not even sure I understand what the difference is. I think it might be the difference between accepting but not requiring leading zeros on numbers in 1, 2, or 3 digits of the year. But for the most part, it seems like you can treat them like an equivalent.
source to share