date format yyyy-MM-ddTHH:mm:ssZ

后端 未结 9 2266
走了就别回头了
走了就别回头了 2020-11-28 04:49

I assume this should be pretty simple, but could not get it :(. In this format Z is time zone.
T is long time pattern
How could I get a date in this format excep

9条回答
  •  青春惊慌失措
    2020-11-28 05:14

    You could split things up, it would require more code but would work just the way you like it:

    DateTime year = DateTime.Now.Year;
    DateTime month = DateTime.Now.Month;
    DateTime day = DateTime.Now.Day;
    

    ect.

    finally:

    Console.WriteLine(year+month+day+etc.);
    

    This is a very bold way of handling it though...

提交回复
热议问题