if (!String.IsNullOrEmpty(dt.Rows[0]["Course_EntryOn"].ToString()))
{
if(Convert.ToDateTime(dt.Rows[0]["Course_EntryOn"].ToString(), System.Globalization.CultureInfo.InvariantCulture)<= DateTime.ParseExact("2022-04-01", "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture) )
}
new SqlParameter("@START_DATE",txtFrom.Text!=""? DateTime.ParseExact(txtFrom.Text,"dd/MM/yyyy",System.Globalization.CultureInfo.InvariantCulture).ToString("MM/dd/yyyy"):null)
if(DateTime.ParseExact(dt.Rows[0]["Course_EntryOn"].ToString(), "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture) <= DateTime.ParseExact("2022-04-01", "MM/dd/yyyy", System.Globalization.CultureInfo.InvariantCulture)
DateTime.ParseExact("03/26/2015", "MM/dd/yyyy", CultureInfo.InvariantCulture)
or
DateTime d1 = new DateTime(1990,01,01);
DateTime d2 = new DateTime(2000, 01, 01);
int result = DateTime.Compare(d1, d2);
or
DateTime TodayDate =
DateTime.ParseExact( DateTime.Now.ToString("dd/MM/yyyy"),
"dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture);
if (ExamDate > TodayDate || ExamDate == TodayDate)
{
}
or
DateTime? CreationDate = null;
DateTime compareDate = DateTime.ParseExact("03/31/2022", "MM/dd/yyyy", System.Globalization.CultureInfo.InvariantCulture);
if (drp_year.SelectedValue != "0")
{
string creationDate = GetCreationDateByEffectiveYear(drp_year.SelectedValue).ToString();
CreationDate = DateTime.ParseExact(Convert.ToDateTime(creationDate).ToString("MM/dd/yyyy"), "MM/dd/yyyy", System.Globalization.CultureInfo.InvariantCulture);
}
if (CreationDate >= compareDate)
{
Int64 sixty = Convert.ToInt64(Total * 0.75);
Int64 forty = Convert.ToInt64(Total * 0.25);
lbl_sixty.Text = "75% (Demand Based) = " + Convert.ToString(sixty);
lbl_forty.Text = "25 % = " + Convert.ToString(forty);
}
or
DateTime dateToCompare = DateTime.ParseExact(DateTime.Now.AddMonths(18).ToString("dd/mm/yyyy"), "dd/mm/yyyy", System.Globalization.CultureInfo.InvariantCulture);
if (!string.IsNullOrEmpty(DataBinder.Eval(e.Row.DataItem, "DOR").ToString()))
{
if (Convert.ToDateTime(DataBinder.Eval(e.Row.DataItem, "DOR"), System.Globalization.CultureInfo.InvariantCulture) <= dateToCompare)
{
e.Row.Cells[23].BackColor = System.Drawing.ColorTranslator.FromHtml("#83f383");
}
}
reference:- https://stackoverflow.com/questions/48692170/how-to-add-one-year-to-current-year-using-datetime
No comments:
Post a Comment