Closed santoshbt closed 2 years ago
Windows timezone identifiers or windows timezone names in some language?
anyway you can get raw data with
zones = TimezoneParser::Data::Storage.WindowsZones
timezones = TimezoneParser::Data::Storage.WindowsTimezones
zone_names = TimezoneParser::Data::Storage.WindowsZones
offsets = TimezoneParser::Data::Storage.WindowsOffsets
Hi davipush,
Thanks a ton for your reply. I think offsets gives me the proper hash, and the keys of which, serves my requirement. But however I need to pass this as an argument to a function, which in turn convert it to proper UTC time of that timezone. Something like this : tz = "West Pacific Standard Time " where "West Pacific Standard Time" is obtained by offset hash keys.
I want to perform something like this, to convert it to UTC. Time.zone = tz time = Time.zone.local( year.to_i, month.to_i, day.to_i, hour.to_i, min.to_i, sec.to_i ).getutc
Is there any command to perform this operation? since it throws error "Invalid Timezone"
I'm not really sure what you're trying to do. Pure Ruby can't convert between different timezones using names. If you want convert between timezones you need to use library such as tzinfo.
With this TimezoneParser you can get timezone's offset by name and then create a time with such offset. Like
offset = TimezoneParser::getOffsets('West Pacific Standard Time')
time = Time.now
time_with_offset = Time.new(time.year, time.month, time.day, time.hour, time.min, time.sec, offset.first)
puts time_with_offset.getutc
Hello,
This actually suites my requirement. But I want the list of timezones in windows format, withot passing any arguments. Please let me know if there is any command for the same.