Hi All,
How to get no of days for a month based on selection? For example, If I choose feb, 2012, i need 29. If feb, 2011, then it should be 28.
Regards,
Kuppusamy S
Hi All,
How to get no of days for a month based on selection? For example, If I choose feb, 2012, i need 29. If feb, 2011, then it should be 28.
Regards,
Kuppusamy S
You can use following code:-
static void getMonthDays(Args _args)
{
if((year(systemDateGet()/provide the date/) mod 4) ==0)
print “29”;
else
print “28”;
pause;
}
Hi Vinay,
Thank you for your response. Actually, I ve an enum type for choosing month and one more enum type for choosing year.
Based on the month and the year I choose, I need to get the no of days for that month and year… This is my requirement. Help me out to resolve this.
Regards,
Kuppusamy S
Hi Kuppusamy,
In the place of y and m varibales take the enum value of month and year in your case…you will get the noofdays in the month…
static void Job15(Args _args)
{
yr y = 2012;
int m = 02;
TransDate endDate;
int NoOfDays;
;
endDate = Global::dateEndMth(mkdate(01,m,y));
NoOfDays = dayOfMth(endDate);
info(strfmt("%1",NoOfDays));
}
Try this…
Naresh Kolli.
Hi,
Based on your month(monthEnumValue) & year(yearEnumValue) value selection you can get the days of months using following code-
if(monthEnumValue==JANUARY || monthEnumValue==MARCH || monthEnumValue==MAY || monthEnumValue==JULY || monthEnumValue==AUGUST ||
monthEnumValue==OCTOBER || monthEnumValue==DECEMBER)
PRINT “31”;
else if(monthEnumValue==APRIL || monthEnumValue==JUNE || monthEnumValue==SEPTEMBER || monthEnumValue==NOVEMBER)
PRINT “30”;
else if(monthEnumValue==FEBRUARY && ((yearEnumValue mod 4) == 0))
PRINT “29”;
else
PRINT “28”;
PAUSE;
Thank you Naresh and Vinay… Both working good… Thank you once again.
Regards,
Kuppusamy S