//**********************************************// //作者:何健# //日期:#2016.10.17# //简述:#模块可公有方法,帮助类# //*********************************************// using System; using Thousandto.Core.Base; namespace Thousandto.Code.Logic { /// /// 类ToolsHelp说明 /// public class HelpTools { /// /// 根据时间戳获取具体时间 /// /// /// public static string GetTimeWithTimestamp(long stamp) { string ret = null; DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); TimeSpan toNow = new TimeSpan(stamp * 10000000); dtStart = dtStart.Add(toNow); ret = dtStart.ToString(LanguageSystem.GetTimeFormatString() + " HH:mm:ss"); return ret; } /// /// 根据时间戳获取时间的小时:分钟:秒 /// /// /// public static string GetHourTimeWithTimestamp(long stamp) { long hour; long minute; long sec; string ret; if (stamp > 0) { minute = stamp / 60; hour = minute / 60; minute = minute % 60; sec = stamp % 60; ret = string.Format("{0}:{1}:{2}", hour, minute, sec); } else { ret = "00:00"; } return ret; } //获取颜色BBCode public static string GetColorBBCodeWithRGB(string rgb, string sText) { string ret = string.Empty; if (rgb != string.Empty && sText != string.Empty) { ret = string.Format("[{0}]{1}[-]", rgb, sText); } return ret; } } }