chore: 首次簽入 Thinkyu ASP.NET 專案
- 加入 Visual Studio / ASP.NET .gitignore - 排除建置輸出、IDE 設定、NuGet packages、大型 MSI 安裝檔
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace 報到系統
|
||||
{
|
||||
public class Utils
|
||||
{
|
||||
/// <summary>
|
||||
/// 依格式選項格式化簽到/簽退時間字串
|
||||
/// timeFormat: "datetime" => 年月日時分秒 (原始值),"time" => 只取 HH:mm
|
||||
/// </summary>
|
||||
public static string FormatTimeValue(string timeValue, string timeFormat)
|
||||
{
|
||||
if (string.IsNullOrEmpty(timeValue))
|
||||
return "";
|
||||
|
||||
if (timeFormat == "time")
|
||||
{
|
||||
// 取 HH:mm,格式為 "yyyy-MM-dd HH:mm:ss" 時從第11碼取5碼
|
||||
return timeValue.Length >= 16 ? timeValue.Substring(11, 5) : timeValue;
|
||||
}
|
||||
|
||||
// datetime 模式回傳原始值
|
||||
return timeValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user