something like this import times, strutils, sugar let dtStr = "2019/06/06 18:17:43 +02:00" dt = parse(dtStr, "YYYY/MM/dd HH:mm:ss zzz") myM10 = newTimezone("M-10", (x: Time) => ZonedTime(utcOffset: Hours.convert(Seconds, 10), time: x), (x: Time) => ZonedTime(utcOffset: Hours.convert(Seconds, 10), time: x)) dtOffset = -1 * dtStr.rsplit(maxsplit=1)[1].split(":", maxsplit=1)[0].parseInt dtTz = newTimezone("DtTz", (x: Time) => ZonedTime(utcOffset: Hours.convert(Seconds, dtOffset), time: x), (x: Time) => ZonedTime(utcOffset: Hours.convert(Seconds, dtOffset), time: x)) dtOrig = dt.inZone(dtTz) dtMy = dt.inZone(myM10) echo dt echo dt.timezone echo dt.utcOffset echo "========" echo dtOrig echo dtOrig.timezone echo dtOrig.utcOffset echo "========" echo dtMy echo dtMy.timezone echo dtMy.utcOffset Run
note: 1. offset should really calculate hours and minutes offset 2. idk why it should be reverted with -1 for setting the timezone (maybe because of time-relativity) 3. you can write an array that populate with timezone at 1 hour interval at compile-time 4. (or) you can provide some external timezone data and read it at compile-time or run-time IMO, the current times module is more pleasant to work with compared to earlier version, kudos for the dev :3