将日期字符串转换为Unix时间戳 [英] Convert a date string to a Unix timestamp
本文介绍了将日期字符串转换为Unix时间戳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解决方案
require'time'
Time.parse(Mon Mar 15 20:51:18 +0000 2010)。to_i
I have this date "Mon Mar 15 20:51:18 +0000 2010". How do i convert this date into a Unix timestamp?
解决方案
require 'time'
Time.parse("Mon Mar 15 20:51:18 +0000 2010").to_i
这篇关于将日期字符串转换为Unix时间戳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文