[英]How to get javascript date format using C# code behind
我正在使用Kendo壓光機,需要突出顯示壓光機中的特定日期。 按照kendo演示,要突出顯示的日期在javascript中如下所示:
dueDates= [
+new Date(today.getFullYear(), today.getMonth(), 8),
+new Date(today.getFullYear(), today.getMonth(), 12),
+new Date(today.getFullYear(), today.getMonth(), 24),
+new Date(today.getFullYear(), today.getMonth() + 1, 6),
+new Date(today.getFullYear(), today.getMonth() + 1, 7),
+new Date(today.getFullYear(), today.getMonth() + 1, 25),
+new Date(today.getFullYear(), today.getMonth() + 1, 27),
+new Date(today.getFullYear(), today.getMonth() - 1, 3),
+new Date(today.getFullYear(), today.getMonth() - 1, 5),
+new Date(today.getFullYear(), today.getMonth() - 2, 22),
+new Date(today.getFullYear(), today.getMonth() - 2, 27)
];
並且dueDates的值為:
[1357583400000,1357929000000,1358965800000,1360089000000,1360175400000,
1361730600000,1361903400000,1354473000000,1354645800000,1353522600000,1353954600000]
我的代碼后面有日期列表,需要將其轉換為上述格式的日期。 請幫助。
這個數字1357583400000
看起來像是從01-01-1970
( Unix Epoch )起的TotalMilliSeconds
。 將其轉換回.Net DateTime。 你可以做:
DateTime dt = new DateTime(1970, 1, 1).AddMilliseconds(1357583400000);
您將獲得: {07/01/2013 6:30:00 PM}
作為DateTime
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.