Thursday, March 4, 2010

How to get Date in Hijrah calendar from Oracle

Hi,

NLS_CALENDAR by default is GEORGIAN in the database so it displays date in Georgian calendar but on demand if u want HIJRI date in Calendar no worries  using To_char we can achieve this


select to_char(sysdate,'fmdd month rrrr','nls_calendar=''arabic hijrah''') from dual

select to_char(sysdate,'fmdd month rrrr','nls_calendar=''english hijrah''') from dual

Output would be like
 
18 ربيع الأول    1431
18 Rabi' Awwal  1431

If we want our database to follow HIJRI calendar then NLS_CALENDAR parameter need to be change
more info about current database settings and valid values

select * from database_properties;
select * from v$nls_parameters;
select * from v$nls_valid_values;

 This tip might helps our Middle-eastern and Saudian guys :)

Regards,
ZB
http://baigsorcl.blogspot.com/

No comments:

Post a Comment