Community forum

Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


shahsaud
2022-08-04T14:43:32Z
For Visual Cron

Below C# code returns true or false if today is first day of the month or not.

using System;

public class FirstDayMonth
{
public static bool FirstDayOfMonth()
{
DateTime now = DateTime.Now;


var firstDay = new DateTime(now.Year, now.Month, 1);

if (now.Day == firstDay.Day)

return true ;
else
return false ;
}
}





Last working day:

using System;

public class LastDayMonth
{
public static bool LastDayOfMonth()
{
DateTime now = DateTime.Now;

int daysInMonth = DateTime.DaysInMonth (now.Year, now.Month);

var lastDay = new DateTime(now.Year, now.Month, daysInMonth);

if (now.Day == lastDay.Day)

return true ;
else
return false ;
}
}


Sponsor
Forum information
Michael Fjellström
2022-11-11T14:51:29Z
Originally Posted by: shahsaud 

For Visual Cron

Below C# code returns true or false if today is first day of the month or not.

using System;

public class FirstDayMonth
{
public static bool FirstDayOfMonth()
{
DateTime now = DateTime.Now;


var firstDay = new DateTime(now.Year, now.Month, 1);

if (now.Day == firstDay.Day)

return true ;
else
return false ;
}
}





Last working day:

using System;

public class LastDayMonth
{
public static bool LastDayOfMonth()
{
DateTime now = DateTime.Now;

int daysInMonth = DateTime.DaysInMonth (now.Year, now.Month);

var lastDay = new DateTime(now.Year, now.Month, daysInMonth);

if (now.Day == lastDay.Day)

return true ;
else
return false ;
}
}




Hi,

Please create a ticket with this issue and send it to support@visualcron.com, as we are preparing to close down this section of the forums. So all technical issues are best (and fastest) solved via email tickets.
Scroll to Top