1 将 Datetime
DateTime dtNow = DateTime.Now; string dtNowStr = dtNow.ToString("yyyy-MM-dd HH:mm:ss");
运行结果 dtNowStr = "2022-02-16 13:41:02"
2 生成一个大于等于最小int32值且小于最大int32值的随机int32值
var rd = new Random(); int num = rd.Next(1, 3); // 生成的num: 1 <= num < 3