when use '/' in pattern, must use '\' to escape it,
when get formatted date string, use the following method:

datefrom.ToString("yyyy-MM-dd")

   1: DateTime datefrom;
   2: try
   3: {
   4:     datefrom = DateTime.ParseExact(txtFromDate.Text.Trim(), "MM\\/dd, yyyy", null); 
   5: }
   6: catch (Exception)
   7: {
   8:     datefrom = new DateTime(1900, 1, 1); 
   9: }
 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-24
  • 2022-12-23
  • 2022-12-23
  • 2021-11-18
  • 2021-08-31
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-30
  • 2022-12-23
  • 2022-03-05
  • 2021-11-29
相关资源
相似解决方案