免费文章,只希望能帮助大家。收费不是我的初衷。
我想写过Java,C#,js....等都需要对时间进行各种操作。
1.戳进行格式化成自己想要的。例如[2019年08月01日,2019-08-01,2019?08?️01?
11:24?️33⏲️,2019:08:01 11-12:22........]2.将时间日期格式转化为时间戳,知道日期例如2019年08月01日,2019-08-01,2018年12月11日,2018年11月15 11:14分89
获取结果是时间戳
3.获取两个时间段内的所有时间段落,我想获取2018-01-20 到 2019-11-23之间的所有日
期。例如:[2018年01月20日,2018年01月21日,2018年01月22日,2018年01月23日......2019
年11月22日,2019年11月23日]
4.获取从那一天起到之后10,20,30.....天内的所有的时间日期.....
5.获取某一个月(或者时间戳)的最后一天日期。例如获取2019-02-05最后一天日期
结果为:2019年02月28日
库地址flutter库地址
1.依赖
dependencies:
luhenchang_plugin: ^0.0.1
2.使用
二. 时间工具类的使用 DateUtils.instance.getMilliseconds(formartDate:"2019-02-11 11月12日01") 1.将时间格式转日期化为时间戳 ///formartDate=2018年12月11日 或者 2019-12-11 或者 2018年11月15 11:14分89 ///结果是毫秒 int getMilliseconds({String formartDate = "1970-10-01 00:00:00"}) 2.格式化时间戳 ///timeSamp:毫秒值 ///format:"yyyy年MM月dd hh:mm:ss" "yyy?MM?dd hh?MM?dd" "yyyy:MM:dd"...... ///结果: 2019?08?04 02?08?02 String getFormartDate(int timeSamp,{format="yyyy年MM月dd hh:mm:ss"}) 3.获取从某一天开始到某一天结束的所有的中间日期,例如输入 startTime:2019:07:31 endTime:2019:08:31 就会返回所有的中间天数。 ///startTime和endTime格式如下都可以 ///使用:List<String> mDate=DateUtils.instance.getTimeBettwenStartTimeAndEnd(startTime:"2019-07-11",endTime:"2019-08-29",format:"yyyy年MM月dd"); ///结果:[2019年07月11, 2019年07月12, 2019年07月13, 2019年07月14, 2019年07月15, 2019年07月16, 2019年07月17, 2019年07月18, 2019年07月19, 2019年07月20, 2019年07月21, 2019年07月22, 2019年07月23, 2019年07月24, 2019年07月25, 2019年07月26, 2019年07月27, 2019年07月28,