Year Functions!

Hello Guys!

I am tryimg to get table’s field of year day moth but I have to write like;

for example the date is 01/01/2016 and i have to return return 2016-quarter 1 in display method to show on form

january february mrah is quarter 1 and april may june is quarter 2 …

I have get the date is from table and then I have to return the date’s quarter and year.

could you guys help me please?

You need to find it from the FiscalCalendarPeriod table
have a look at, \Classes\FiscalCalendars\findQuarterByDate

I hope you will be knowing how to get the year from the date.

Hi,

Try Like this…

static void SK_date(Args _args)
{
    int month;

month = mthOfYr(systemDateGet());
    info(strFmt(int2str(month)));
    if(month<=3)
    {
        info(strFmt('Quarter1-%1',year(systemDateGet())));
    }
    else if(month >= 4 && month < 7)
    {
         info(strFmt('Quarter2-%1',year(systemDateGet())));
    }
    
}

thank you so much for reply
but I neeed to use table’s date field not the systemdate i wrote the this display but it does not make sense
display Date dispyear1()
{
vendtable vendtable ;

transdate AccountingDate;

d= vendTable.AccountingDate;

int month;

month =mthofyear(table.AccountingDate);
if(month<=3)
{
d = strFmt(“Quarter1-%1”,year(vendTable.AccountingDate);
}
else if()

else if()

return d;
}

usually ı am seeing year(today()); something like that.I am confusing about the getting date from the table’s field actually

You don’t have to reinvent the wheel. You already have the code in, \Classes\FiscalCalendars\findQuarterByDate.

What is the issue with fetching the date from table? (table.dateField)

I would suggest looking at the cross references of the method, \Classes\FiscalCalendars\findQuarterByDate, to know how to use it.

thank you so much!it works