Function ConvertToHijri(&gregorianDate As date) Returns string
Local SQL &sql;
Local string &hijriDate;
Local string &oracleDate;
/* Convert PeopleCode date to Oracle-compatible date string (YYYY-MM-DD) */
&oracleDate = DateTimeToLocalizedString(&gregorianDate, "MM-dd-yyyy");
/* SQL to convert the Gregorian date to Hijri */
&sql = CreateSQL(" SELECT TO_CHAR(TO_DATE(:1, 'mm-dd-yyyy'), 'mm-dd-yyyy', 'nls_calendar=''Arabic Hijrah''') FROM DUAL ", &oracleDate);
/* Fetch the result */
If &sql.Fetch(&hijriDate) Then
Return &hijriDate;
Else
/* Return an empty string if the conversion fails */
Return "";
End-If;
End-Function;
No comments:
Post a Comment