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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With