2009-09-29 29 views

回答

6
public static DateTime StartOfRecordedHistory = new DateTime(2004, 1, 1) 
+0

謝謝!那很快。 – 2009-09-29 09:20:04

5
public static readonly DateTime StartOfRecordedHistory = new DateTime(2004, 1, 1); 

沒有更優雅,我承認,但它避免了與區域設置相關的日期解析的任何問題。

如果你正在尋找日期文字,不幸的是C#不提供它們。

0

使用

public static DateTime StartOfRecordedHistory = new DateTime(2004, 1, 1) 

可能是最好的方法,因爲它已經指出的那樣,它不具有不同的日期時間格式的任何問題。

有很多DateTime的創建者 - 請參閱MSDN documentation,這樣您就可以得到您想要的確切日期格式。

相關問題