zoukankan      html  css  js  c++  java
  • 生成订单号

    //生成订单号
        public string GetOrderNO()
        {
            StringBuilder result = new StringBuilder();
            DateTime now = DateTime.Now;
            result.Append(now.Year.ToString().Substring(2, 2));
            string month = now.Month.ToString();
            result.Append(month.Length < 2 ? "0" + month : month);
            string day = now.Day.ToString();
            result.Append(day.Length < 2 ? "0" + day : day);
            String hour = now.Hour.ToString();
            result.Append(hour.Length < 2 ? "0" + hour : hour);
            string minute = now.Minute.ToString();
            result.Append(minute.Length < 2 ? "0" + minute : minute);
            string second = now.Second.ToString();
            result.Append(second.Length < 2 ? "0" + second : second);
            int last = new Random().Next(10000);
            result = result.Append(last.ToString());
            if (last > 99 && last <= 999)
            {
                result = result.Append("0");
            }
            else if (last > 9 && last <= 99)
            {
                result = result.Append("00");
            }
            else if (last <= 9)
            {
                result = result.Append("000");
            }
            else
            {
    
            }
            return result.ToString();
        }
  • 相关阅读:
    Python修饰符实践
    回文
    Linux下安装Qt
    Linux下安装PyQT
    Python闭包实践
    杂乱
    windows下脚本转到linux下,文件保存格式要转换
    lua table.sort的bug
    shell截取某段
    coredump
  • 原文地址:https://www.cnblogs.com/huangzebin/p/6943800.html
Copyright © 2011-2022 走看看