91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

asp.net常用的驗證和獲取日期的方法

發布時間:2020-05-03 11:52:04 來源:網絡 閱讀:399 作者:wglzaj 欄目:編程語言

public string GetWeekOfFirstDay()
{
string ReasonTime;
switch (DateTime.Now.Date.DayOfWeek.ToString())
{
case "Monday":
ReasonTime=DateTime.Now.Date.ToString("yyyy-MM-dd");
return ReasonTime;
case "Tuesday":
ReasonTime = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd");
return ReasonTime;
case "Wednesday":
ReasonTime = DateTime.Now.AddDays(-2).ToString("yyyy-MM-dd");
return ReasonTime;
case "Thursday":
ReasonTime = DateTime.Now.AddDays(-3).ToString("yyyy-MM-dd");
return ReasonTime;
case "Friday":
ReasonTime = DateTime.Now.AddDays(-4).ToString("yyyy-MM-dd");
return ReasonTime;
case "Saturday":
ReasonTime = DateTime.Now.AddDays(-5).ToString("yyyy-MM-dd");
return ReasonTime;
case "Sunday":
ReasonTime = DateTime.Now.AddDays(-6).ToString("yyyy-MM-dd");
return ReasonTime;
default:
return DateTime.Now.Date.DayOfWeek.ToString("yyyy-MM-dd");
}
}// end GetWeekOfFirstDay()
public string TheFirstDayOfMonth()
{
int DayOfMonth = DateTime.Now.Day;
return DateTime.Now.AddDays(-DayOfMonth + 1).ToString("yyyy-MM-dd");
}
public string TheEndDayOfMonth()
{
int aMonthHaveDays = DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month);
int DayOfMonth = DateTime.Now.Day;
int TheEndOfMonth = aMonthHaveDays - DayOfMonth;
return DateTime.Now.AddDays(TheEndOfMonth).ToString("yyyy-MM-dd");
}
public string TheFirstDayOfYear()
{//return2007-1-1
int dayOfYear = DateTime.Now.DayOfYear;
return DateTime.Now.AddDays(-dayOfYear + 1).ToString("yyyy-MM-dd");
}
public string TheEndDayOfYear()
{//return 2007-12-31
int month22HaveDays=DateTime.DaysInMonth(DateTime.Now.Year,12);
return DateTime.Now.Year + "-12-" + month22HaveDays;
}
public string GetDayAddWeekofDay(string strTime)
{//return 2007-3-3星期三
string Time = CultureInfo.CurrentCulture.Calendar.GetDayOfWeek(Convert.ToDateTime(strTime)).ToString();
strTime = Convert.ToDateTime(strTime).ToString("yyyy-MM-dd");
switch (Time)
{
case "Monday":
strTime = strTime + "(星期一)";
return strTime;
case "Tuesday":
strTime = strTime + "(星期二)";
return strTime;
case "Wednesday":
strTime = strTime + "(星期三)";
return strTime;
case "Thursday":
strTime = strTime + "(星期四)";
return strTime;
case "Friday":
strTime = strTime + "(星期五)";
return strTime;
case "Saturday":
strTime = strTime + "(星期六)";
return strTime;
case "Sunday":
strTime = strTime + "(星期日)";
return strTime;
default:
return strTime;
}
}//end GetDayAddWeekofDay(string strTime)
public string GetFormatTime(string time)
{//return yyyy-MM-dd
if (time == "")
{
return "";
}
else
{
return Convert.ToDateTime(time).ToString("yyyy-MM-dd");
}
}
public string GetFormatMinutes(string time)
{
if (time == "")
{
return "";
}
else
{
return Convert.ToDateTime(time).ToString("yyyy-MM-dd HH:mm");
}
}
public bool RegexLongTime(string time)
{//yyyy-MM-dd hh:mm:ss
bool tureTime;
tureTime = System.Text.RegularExpressions.Regex.IsMatch(time, @"^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})$");
return tureTime;
}
public bool RegexDate(string time)
{//yyyy-MM-dd
bool reasonTime;
string regex = @"^(19|20)\d\d[- /.](0[1-9]|1[012]|[1-9])[- /.](0[1-9]|[12][0-9]|3[01]|[1-9])$";
reasonTime = System.Text.RegularExpressions.Regex.IsMatch(time,regex);
return reasonTime;
}
public bool RegexInt32(string strInt)
{//int32
return System.Text.RegularExpressions.Regex.IsMatch(strInt, @"^\d+$");
}

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

涞水县| 虞城县| 荣昌县| 清丰县| 新邵县| 绿春县| 通化市| 霍邱县| 包头市| 准格尔旗| 绥宁县| 叶城县| 哈巴河县| 阿坝县| 灵寿县| 溆浦县| 睢宁县| 三亚市| 德阳市| 澎湖县| 饶平县| 镇巴县| 兴和县| 漳浦县| 罗定市| 汉寿县| 垫江县| 乐昌市| 高州市| 新野县| 南靖县| 抚顺县| 昔阳县| 拉萨市| 涟源市| 密山市| 和硕县| 淳安县| 阜平县| 吐鲁番市| 仁寿县|