C# 生成一天内不重复的int 值

  public static int ConvertDateTimeToInt(System.DateTime time)
        {
            System.DateTime startTime = System.TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc));
            string timeHours = (time - startTime).Hours.ToString().PadLeft(2, ‘0‘);
            string timeMinutes = (time - startTime).Minutes.ToString().PadLeft(2, ‘0‘);
            string timeSeconds = (time - startTime).Seconds.ToString().PadLeft(2, ‘0‘);
            string timeStamp = (time - startTime).Milliseconds.ToString().PadLeft(2, ‘0‘);

            int timeInt = Convert.ToInt32(timeHours.ToString() + timeMinutes.ToString() + timeSeconds.ToString() + timeStamp.ToString());

            return timeInt;
        }

C# 生成一天内不重复的int 值

上一篇:使用cmd 激活win10正式版


下一篇:Swing组件中,在标签Label上插图标及图片Icon