H
hemant
I have got following method in my code:
def to_time
if time? then
Time.mktime(year,month,day_of_month,hour,minute,second,usec)
else
Time.mktime(year,month,day_of_month)
end
end
In my class, I also have timezone/utc offset as an attribute and above
method basically returns a Time object based on those attributes.
But as you can see, Time.mktime is going to convert that time to local
zone and return that value. So, is there anyway to get a Time object
by passing above said attributes and timezone/offset in timezone
specified. That is, no automatic conversion to utc or local zone.
def to_time
if time? then
Time.mktime(year,month,day_of_month,hour,minute,second,usec)
else
Time.mktime(year,month,day_of_month)
end
end
In my class, I also have timezone/utc offset as an attribute and above
method basically returns a Time object based on those attributes.
But as you can see, Time.mktime is going to convert that time to local
zone and return that value. So, is there anyway to get a Time object
by passing above said attributes and timezone/offset in timezone
specified. That is, no automatic conversion to utc or local zone.