Luca_Roma
(Luca Roma)
#1
Hi, i'm using facebooker for receiving facebook's events.
I receive the time of the event in utc format.
how can i import it in a Time object
in other words
a= Time.now.utc
how can i import a in a Time object??
this not works
Time.parse(a)
thanks
···
--
Posted via http://www.ruby-forum.com/.
The ActiveSupport gem has a time zone class:
require 'active_support'
utc = Time.now.utc
# => Wed Sep 16 17:28:58 UTC 2009
utc.class
# => Time
zone = ActiveSupport::TimeZone['Eastern Time (US & Canada)']
eastern = zone.at(utc.to_f)
# => Wed, 16 Sep 2009 13:28:58 EDT -04:00
eastern.class
# => ActiveSupport::TimeWithZone
···
At 2009-09-16 12:12PM, "Luca Roma" wrote:
Hi, i'm using facebooker for receiving facebook's events.
I receive the time of the event in utc format.
how can i import it in a Time object
in other words
a= Time.now.utc
how can i import a in a Time object??
this not works
Time.parse(a)
--
Glenn Jackman
Write a wise saying and your name will live forever. -- Anonymous
Hi,
Hi, i'm using facebooker for receiving facebook's events.
I receive the time of the event in utc format.
how can i import it in a Time object
in other words
a= Time.now.utc
how can i import a in a Time object??
this not works
Time.parse(a)
UTC is a time zone, not a format. You need to load "time.rb".
t = Time.now
str_l = t.to_s
t.utc
str_u = t.to_s
require "time"
q = Time.parse str_l
puts q
q = Time.parse str_u
puts q
Bertram
···
Am Donnerstag, 17. Sep 2009, 01:12:30 +0900 schrieb Luca Roma:
--
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de