Convert date to HijriDate D365 FO X++

    public str HijriDate(smmQuotationFollowUpDate _transDate)
    {
        smmQuotationFollowUpDate dt;
        int HijriDt;
        int HijriMonth;
        str Yr,finaldate;
        int findate;
        CalendarConverter CalendarConverter;
        str Hijridat,HijriMnth,HijriYr;
        ;

        dt = _transDate;
        CalendarConverter = new CalendarConverter(PreferredCalendar::Hijri);
        HijriDt = CalendarConverter.dayofmth(dt);
        HijriMonth = CalendarConverter.mthofyr(dt);
        Yr = CalendarConverter.yearStr(dt);

        Hijridat = int2str(HijriDt);
        HijriMnth = int2str(HijriMonth);
        HijriYr = subStr(Yr,1,5);// Sub string is taken as i want to return only two digits of year
        finaldate = Hijridat+"/"+HijriMnth+"/"+HijriYr;
        return finaldate;
    }

Leave Comment

Your email address will not be published. Required fields are marked *