Convert foreign time zone to local time zone:
First, get the time zone offset by googling it. For example: “BST“ offset is “+0100”.
Then run the following lines in “irb”:
1 | > require 'time' |
Convert local time zone to foreign time zone:
First, get the target time zone’s time zone offset, For an example, I want to know what’s the EDT time for my local time “2012-05-12 17:50:22 +0800”. The “EDT“ time zone offest is “-0400”, then run the following lines in “irb”:
1 | > require 'time' |
Actually this is a workaround to only get the number, so just ignore the “UTC” in the result.