File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -370,6 +370,42 @@ public static int CurrentTimeWithUtcDay()
370370 return Convert . ToInt32 ( DateTime . UtcNow . ToString ( "yyyyMMdd" ) ) ;
371371 }
372372
373+ /// <summary>
374+ /// 获取当前UTC时间,格式为HHmmss的字符串
375+ /// </summary>
376+ /// <returns>返回一个6位字符串,表示当前UTC时间。例如:143045表示14:30:45</returns>
377+ public static string CurrentTimeWithUtcFullString ( )
378+ {
379+ return DateTime . UtcNow . ToString ( "HHmmss" ) ;
380+ }
381+
382+ /// <summary>
383+ /// 获取当前本地时间,格式为HHmmss的字符串
384+ /// </summary>
385+ /// <returns>返回一个6位字符串,表示当前本地时间。例如:143045表示14:30:45</returns>
386+ public static string CurrentTimeWithLocalFullString ( )
387+ {
388+ return DateTime . Now . ToString ( "HHmmss" ) ;
389+ }
390+
391+ /// <summary>
392+ /// 获取当前UTC时间,格式为HHmmss的整数
393+ /// </summary>
394+ /// <returns>返回一个6位整数,表示当前UTC时间。例如:143045表示14:30:45</returns>
395+ public static int CurrentTimeWithUtcTime ( )
396+ {
397+ return Convert . ToInt32 ( CurrentTimeWithUtcFullString ( ) ) ;
398+ }
399+
400+ /// <summary>
401+ /// 获取当前本地时间,格式为HHmmss的整数
402+ /// </summary>
403+ /// <returns>返回一个6位整数,表示当前本地时间。例如:143045表示14:30:45</returns>
404+ public static int CurrentTimeWithLocalTime ( )
405+ {
406+ return Convert . ToInt32 ( CurrentTimeWithLocalFullString ( ) ) ;
407+ }
408+
373409 /// <summary>
374410 /// 获取当前本地时区时间的完整格式字符串
375411 /// </summary>
You can’t perform that action at this time.
0 commit comments