I have written this PL/SQL Expression for a timestamp datepicker:
TO_CHAR(SYSDATE,'DD-MON-YYYY HH24:MI:SS')
But it returns time in wrong timezone. What did I miss?
Thanks
I have written this PL/SQL Expression for a timestamp datepicker:
TO_CHAR(SYSDATE,'DD-MON-YYYY HH24:MI:SS')
But it returns time in wrong timezone. What did I miss?
Thanks
But it returns time in wrong timezone. What did I miss?
I cringed a little when reading this. You missed how time zones work in your database. This means you may have a lot of time zone issues baked into your data model now. I hope I'm wrong! :)
Rather than try to fix this one specific problem, you should start by learning about how Oracle works with temporal values.
You'll know you're ready to tackle the problem when you can answer these questions:
Solution 1:
BEGIN
APEX_UTIL.SET_SESSION_TIME_ZONE(P_TIME_ZONE => '<you_timezone_here>');
END;
Solution 2:
BEGIN
EXECUTE IMMEDIATE 'ALTER SESSION SET TIME_ZONE = ''<you_time_zone_here>''';
END;
For all database sessions, both solutions can be implemented in Edit Application Definition -> Security -> Database Session -> Initialization PL/SQL Code. For especific code, add the chosen solution into PL/SQL code.
You need to synchronize your browser's timezone and Oracle DB. Go to shared components - Globalisation - enable Automatic Time Zone.