Home > Blockchain >  change return format of bootstrap date picker
change return format of bootstrap date picker

Time:12-22

I am using a bootstrap date picker in a C# web application. The application connects to an Oracle 11g database

The Date Picker returns the date in the format YYYY-MM-DDThh:mm e.g. 2021-12-21T09:46. None of the to_date functions in 11g that I know of can handle this. I've tried the following.

 select TO_DATE ('2021-12-21T09:46', 'YYYY-MM-DDThh:mi') from dual; -- ORA-01821: date format not recognized

 select TO_TIMESTAMP ('2021-12-21T09:46', 'YYYY-MM-RRTHH24:MI') from dual; -- ORA-01821: date format not recognized

 select TO_TIMESTAMP_TZ ('2021-12-21T09:46', 'YYYY-MM-DDTHH:MI:SS') from dual; -- ORA-01821: date format not recognized

 SELECT SYS_EXTRACT_UTC(TIMESTAMP '2021-12-21T09:46:00') FROM DUAL; -- ORA-01821: date format not recognized

 select TO_UTC_TIMESTAMP_TZ ('2021-12-21T09:46:00', 'YYYY-MM-DDThh:mm:ss') from dual; -- ORA-00904: "TO_UTC_TIMESTAMP_TZ": invalid identifier

Is there another function that I can use?

Is there a way of changing the format that the datepicker returns? Please note that I need to change the RETURNED date not the DISPLAYED date.

CodePudding user response:

The database doesn't like the T in the date format mask. Fortunately we can handle that by wrapping it in double-quotes:

select TO_DATE ('2021-12-21T09:46', 'YYYY-MM-DD"T"HH24:MI') from dual; 
  • Related