I have the value 2016001
symbolizing the first day of the year 2016, how do I get for example ANO/MES
2016263
?
Example:
ENTRADA: $data = '2016001'
SAÍDA: $anomes = '2016-01'
If you could do the inverse of this SQL
:
SELECT extract (DOY FROM TIMESTAMP '2016-12-31 23:59:59') AS day;
EXIT: 366
EDITED:
So I just extract the number from the day of the year:
SELECT SUBSTRING (TO_CHAR (2016263, '9999999') FROM 6 FOR 3)
EXIT: 263
Or the easy way:
SELECT RIGHT (2016263 :: VARCHAR, 3);
EXIT: 263