I have the following string 2012-7-31 09:38:00.000000
which I want to convert to type timestamp (without time zone) in PGadmin. Which methods in ruby can get the job done?
Thanks
I have the following string 2012-7-31 09:38:00.000000
which I want to convert to type timestamp (without time zone) in PGadmin. Which methods in ruby can get the job done?
Thanks
Try
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