protected void Page_Load(object sender, EventArgs e)
{
{
DateTime dtRet = GetFirstInMonth(GetDateValue("2010-03-02"));
Label1.Text = dtRet.ToShortDateString();
Label1.Text = dtRet.ToShortDateString();
}
public static DateTime GetFirstInMonth(DateTime dt)
{
DateTime dtRet = new DateTime(dt.Year, dt.Month, 1, 0, 0, 0);
return dtRet;
}
Output:
3/1/2010
{
DateTime dtRet = new DateTime(dt.Year, dt.Month, 1, 0, 0, 0);
return dtRet;
}
Output:
3/1/2010
No comments:
Post a Comment