DateTimeExtendGetString(DateTime, String) Method
依格式取得日期字串
Namespace: eBizprise.FrameworkAssembly: eBizprise.Framework.DatetimeHelper (in eBizprise.Framework.DatetimeHelper.dll) Version: 25.0.0.0+adf38c4ccb2bf98d8ad258a6278302b5e05a94ed
public static string GetString(
this DateTime dateTime,
string format
)
- dateTime DateTime
- DateTime擴充屬性
- format String
格式字串;依原定義之格式化字串擴充:
CY:民國年
StringstringIn Visual Basic and C#, you can call this method as an instance method on any object of type
DateTime. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
取來源日期時間依指定格式轉換為日期時間字串後回傳。無法正確轉換時回傳異常
string dateTimeString = new DateTime().GetString("yyyy/MM/dd HH:mm:ss");
string chineseDateTimeString = new DateTime().GetString("CY/MM/dd HH:mm:ss");
| Date | Version | Description |
|---|
| 2020/02/07 | 1.0.0.0 | 初版 |
| 2025/09/19 | 25.0.0.0 | 彙整2025年度初版 |