java转换成秒数 Date类有一个getTime()可以换回秒数,例如: public class DateToSecond { public static void main(String[] args) { Date date = new Date(System.currentTimeMillis()); System.out.println(date.getTime()); } } 或者直接使用long类型存储毫秒数, long base = System.currentTimeMill
之前写过一篇关于把秒转换成指定的日期格式 Lua date format 接到一个需求,需要从配置文件中读取活动显示时间段:startDate ~ endDate(格式为:yyyy-mm-dd HH:MM:SS),然后与服务器返回的时间进行比较,如果在该时间段内则显示该活动,如何实现呢? 首先我们借助"split"函数来获得相应的年.月.日.时.分.秒,然后将其转换为秒再比较 -- Compatibility: Lua-5.1function split(str, pat) l