Files
sryang 577060bc78 chore: 首次簽入 Thinkyu ASP.NET 專案
- 加入 Visual Studio / ASP.NET .gitignore
- 排除建置輸出、IDE 設定、NuGet packages、大型 MSI 安裝檔
2026-09-10 09:42:37 +08:00

29 lines
843 B
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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;
}
}
}