Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有以下字符串2012-7-31 09:38:00.000000,我想在PGadmin 中将其转换为类型时间戳(无时区) 。ruby 中的哪些方法可以完成工作?
2012-7-31 09:38:00.000000
谢谢
尝试
DateTime.parse("2012-7-31 09:38:00.000000") #output Tue, 31 Jul 2012 09:38:00 +0000 DateTime.parse("2012-7-31 09:38:00.000000").to_i #output is timestamp 1343727480
Time.parse("2012-7-31 09:38:00.000000").to_i