[英]UTC DateTime back to Original datetime
I have probably just stared at this too long... 我可能只是盯着这个太久了...
I have a third-party datepicker (ASP/MVC) and I stringify the array of selected dates and pass it to the controller. 我有一个第三方datepicker(ASP / MVC),我将选定日期的数组字符串化并将其传递给控制器。
example: 例:
I know that this is meant to be midnight since it is from a timeless datepicker. 我知道这是午夜,因为它来自永恒的日期选择器。
In c#, how do I convert this back to its original time? 在C#中,如何将其转换回原始时间? I am in PST but that should not matter. 我在PST,但这无关紧要。
Try 尝试
string date = "2013-05-21T04:00:00Z" ;
DateTime dt = Datetime.parse(date);
dt = dt.Date;
You will get the date component only, with the time component as midnight. 您将仅获得日期部分,而时间部分为午夜。 I hope this satisfies your requirement. 我希望这能满足您的要求。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.