C# – 設定 Eval 裡的 Datetime 格式

<%# Eval("SDate", "{0:yyyy/MM/dd}") %>
// 0: 表示定義整個括號裡面的第 0 個變數要採用此日期格式。

// 以下為兩個變數的範例。
string s = String.Format("At {0}, the temperature is {1}°C.",
                         DateTime.Now, 20.4);
Console.WriteLine(s);
// Output similar to: 'At 4/10/2015 9:29:41 AM, the temperature is 20.4°C.'

【参考链接】

留下回复

您的电子邮件地址不会被公开. 必填项已标注 *

本网站使用 Akismet 来减少垃圾评论. 了解您的评论数据如何被处理.