Ramco Ramco

Ramco Ramco

  • 441
  • 3.4k
  • 523.2k

Time Comparison

Aug 29 2022 3:49 PM

Hi

  I have below code & i want if Dates are same them tots should be greater than frts

                DateTime? dtFrom = null;
                DateTime? dtTo = null;                    

if (txtdtFrom.Text.Trim() != "")
                    {
                        DateTime PMDate2 = DateTime.ParseExact(txtdtFrom.Text, "dd-MM-yyyy", System.Globalization.CultureInfo.InvariantCulture);
                        dtFrom = Convert.ToDateTime(PMDate2.ToString("yyyy-MM-dd"));
                    }

                    DateTime? DOB = null;

                    if (txtdtTo.Text.Trim() != "")
                    {
                        DateTime PMDate2 = DateTime.ParseExact(txtdtTo.Text, "dd-MM-yyyy", System.Globalization.CultureInfo.InvariantCulture);
                        dtTo = Convert.ToDateTime(PMDate2.ToString("yyyy-MM-dd"));
                    }


                        DateTime StartTime = DateTime.Now;
                        String frTime = ddlTimeFrom.SelectedItem.Value;
                        var frts = TimeSpan.Parse(frTime);
                        String toTime = ddlTimeTo.SelectedItem.Value;
                        var tots = TimeSpan.Parse(toTime);

Thanks


Answers (1)