// DATE FUNCTIONS
// Get Current Year
protected int _currentYear()
{
DateTime dtn = DateTime.Now;
int ret= dtn.Year;
return ret;
}//**
// Get Current Month
protected int _currentMonth()
{
DateTime dtn = DateTime.Now;
int ret = dtn.Month;
return ret;
}//**
// Get current month in string
protected string _curMonthStr()
{
string thismonth = String.Format("{0:MMMM}", DateTime.Now).ToString();
return thismonth;
}
// Get Current Day
protected int _currentDay()
{
DateTime dtn = DateTime.Now;
int ret = dtn.Day;
return ret;
}//**
// Get Sundays for this month
protected int[] getSundays(int year, int month, DayOfWeek dayName)
{
int[] _sunday = new int[4];
CultureInfo ci = new CultureInfo("en-US");
int ai = 0;
for (int i = 1; i <= ci.Calendar.GetDaysInMonth(year, month); i++)
{
if (new DateTime(year, month, i).DayOfWeek == dayName)
{
//Response.Write(i.ToString());
_sunday[ai] = i; ai += 1;
}
}
return _sunday;
}//**
No comments:
Post a Comment