Timezone conversion by command line
I know about http://www.timeanddate.com/worldclock/converter.html
I can't figure out how to query http://www.google.com in a sane natural format like "5pm BST in PST".
Or do I have to write such an app?
linux command-line conversion time date
add a comment |
I know about http://www.timeanddate.com/worldclock/converter.html
I can't figure out how to query http://www.google.com in a sane natural format like "5pm BST in PST".
Or do I have to write such an app?
linux command-line conversion time date
What do you mean exactly? Command line linux? Command you can type into Google? What?!
– Dal Hundal
Jul 16 '10 at 9:37
command line in shell and google's query box are both a command line to me
– hendry
Jul 16 '10 at 9:42
1
perhaps a better tool would do cities by airport codes, 5pm LHR in SFO
– hendry
Jul 16 '10 at 9:42
@hendry dateutils can do timezone conversion based on iata and icao airport codes:dateconv 2017-05-16T17:00 --from-zone iata:SFO --zone iata:LHR
->2017-05-17T01:00:00
– hroptatyr
May 16 '17 at 9:10
add a comment |
I know about http://www.timeanddate.com/worldclock/converter.html
I can't figure out how to query http://www.google.com in a sane natural format like "5pm BST in PST".
Or do I have to write such an app?
linux command-line conversion time date
I know about http://www.timeanddate.com/worldclock/converter.html
I can't figure out how to query http://www.google.com in a sane natural format like "5pm BST in PST".
Or do I have to write such an app?
linux command-line conversion time date
linux command-line conversion time date
edited Nov 13 '11 at 8:24
Daniel Beck♦
93.1k12235288
93.1k12235288
asked Jul 16 '10 at 9:29
hendryhendry
9142917
9142917
What do you mean exactly? Command line linux? Command you can type into Google? What?!
– Dal Hundal
Jul 16 '10 at 9:37
command line in shell and google's query box are both a command line to me
– hendry
Jul 16 '10 at 9:42
1
perhaps a better tool would do cities by airport codes, 5pm LHR in SFO
– hendry
Jul 16 '10 at 9:42
@hendry dateutils can do timezone conversion based on iata and icao airport codes:dateconv 2017-05-16T17:00 --from-zone iata:SFO --zone iata:LHR
->2017-05-17T01:00:00
– hroptatyr
May 16 '17 at 9:10
add a comment |
What do you mean exactly? Command line linux? Command you can type into Google? What?!
– Dal Hundal
Jul 16 '10 at 9:37
command line in shell and google's query box are both a command line to me
– hendry
Jul 16 '10 at 9:42
1
perhaps a better tool would do cities by airport codes, 5pm LHR in SFO
– hendry
Jul 16 '10 at 9:42
@hendry dateutils can do timezone conversion based on iata and icao airport codes:dateconv 2017-05-16T17:00 --from-zone iata:SFO --zone iata:LHR
->2017-05-17T01:00:00
– hroptatyr
May 16 '17 at 9:10
What do you mean exactly? Command line linux? Command you can type into Google? What?!
– Dal Hundal
Jul 16 '10 at 9:37
What do you mean exactly? Command line linux? Command you can type into Google? What?!
– Dal Hundal
Jul 16 '10 at 9:37
command line in shell and google's query box are both a command line to me
– hendry
Jul 16 '10 at 9:42
command line in shell and google's query box are both a command line to me
– hendry
Jul 16 '10 at 9:42
1
1
perhaps a better tool would do cities by airport codes, 5pm LHR in SFO
– hendry
Jul 16 '10 at 9:42
perhaps a better tool would do cities by airport codes, 5pm LHR in SFO
– hendry
Jul 16 '10 at 9:42
@hendry dateutils can do timezone conversion based on iata and icao airport codes:
dateconv 2017-05-16T17:00 --from-zone iata:SFO --zone iata:LHR
-> 2017-05-17T01:00:00
– hroptatyr
May 16 '17 at 9:10
@hendry dateutils can do timezone conversion based on iata and icao airport codes:
dateconv 2017-05-16T17:00 --from-zone iata:SFO --zone iata:LHR
-> 2017-05-17T01:00:00
– hroptatyr
May 16 '17 at 9:10
add a comment |
5 Answers
5
active
oldest
votes
It's 6pm in Taipei, what time is it here?
date --date='TZ="Asia/Taipei" 18:00'
Fri Jul 16 11:00:00 BST 2010
At 11am here in London, what time is it in Taipei?
TZ=Asia/Taipei date -d "11:00 BST"
Fri Jul 16 18:00:00 CST 2010
Strange, but the first way doesn't work for me:TZ=Europe/Moscow date --date='TZ="Asia/Taipei" 18:00'
Mon Mar 27 18:00:00 CST 2017
-- i.e. it just tells me the date in Taipei, not my local date for that time point. Although manpage says your method is correct. Am I missing something?..coreutils 8.26
, Arch Linux
– MarSoft
Mar 27 '17 at 1:45
add a comment |
This example is from http://www.pixelbeat.org/cmdline.html#dates
It gives the local time corresponding to 9AM on the west coast of the US,
accounting for differing day light savings transitions.
date --date='TZ="America/Los_Angeles" 09:00 next Fri'
Use tzselect to get the TZ. The PST format is ambiguous.
IST = Indian Standard Time and Irish Summer Time for example.
2
Didn't know abouttzselect
, thanks. If you enter wrong 'TZ' input you can get misleading results, e.g. TZ=London date Fri Jul 16 10:28:52 London 2010
– hendry
Jul 16 '10 at 10:29
add a comment |
I think this is closer to what the OP asked (Since he doesn't necessarily know that BST is Taipei? and the answer doesn't explain how to get to "Asia/Taipei" from 'BST').
First my current date:
$ date
Mon Apr 21 13:07:21 MDT 2014
Then the date I want to know:
$ date -d '5pm BST'
Mon Apr 21 15:00:00 MDT 2014
So I know that 5pm BST
is 2 hours away.
I usually forget if I have to add or remove two hours from EDT times so I have a little script with the common timezones I have to work with:
$ cat tz
#!/bin/bash
TZ='America/Edmonton' date
TZ='America/Chicago' date
TZ='America/New_York' date
And the output:
$ tz
Mon Apr 21 13:12:32 MDT 2014
Mon Apr 21 14:12:32 CDT 2014
Mon Apr 21 15:12:32 EDT 2014
Valid locations for your tz
script can be found here /usr/share/zoneinfo
.
But again, for times in the future I just use date -d '<time> <timezone>'
.
add a comment |
Use Wolfram Alpha. To the basic URL…
http://www.wolframalpha.com/input/?i=
append the conversion, with spaces replaced by +
. For example:
http://www.wolframalpha.com/input/?i=5+PM+CET+to+PST
Note that Wolfram Alpha does not seem to recognize BST
as a time zone.
how does one quickly look up time zone codes?
– hendry
Jul 16 '10 at 10:31
@hendry This is a cool interactive online map: timeanddate.com/time/map/#!cities=241
– DavidG
Apr 21 '14 at 19:48
add a comment |
I know it is an old thread, but I needed a code for the same use case and, based on the ideas here, developed this little bash script:
#!/bin/bash
# ig20180122 - displays meeting options in other time zones
# set the following variable to the start and end of your working day
myday="8 20" # start and end time, with one space
# set the local TZ
myplace='America/Sao_Paulo'
# set the most common places
place[1]='America/Toronto'
place[2]='America/Chicago' # Houston as well
place[3]='Europe/Amsterdam'
place[4]='Europe/Dublin'
# add cities using place[5], etc.
# set the date format for search
dfmt="%m-%d" # date format for meeting date
hfmt="+%B %e, %Y" # date format for the header
# no need to change onwards
format1="%-10s " # Increase if your cities are large
format2="%02d "
mdate=$1
if [[ "$1" == "" ]]; then mdate=`date "+$dfmt"`; fi
date -j -f "$dfmt" "$hfmt" "$mdate"
here=`TZ=$myplace date -j -f "$dfmt" +%z "$mdate"`
here=$((`printf "%g" $here` / 100))
printf "$format1" "Here"
printf "$format2" `seq $myday`
printf "n"
for i in `seq 1 "${#place[*]}"`
do
there=`TZ=${place[$i]} date -j -f "$dfmt" +%z "$mdate"`
there=$((`printf "%g" $there` / 100))
city[$i]=${place[$i]/*//}
tdiff[$i]=$(($there - $here))
printf "$format1" ${city[$i]}
for j in `seq $myday`
do
printf "$format2" $(($j+${tdiff[$i]}))
done
printf "(%+d)n" ${tdiff[$i]}
done
You can either use to check the time differences today or in a future date:
16:08 $ meet
January 22, 2019
Here 08 09 10 11 12 13 14 15 16 17 18 19 20
Toronto 05 06 07 08 09 10 11 12 13 14 15 16 17 (-3)
Chicago 04 05 06 07 08 09 10 11 12 13 14 15 16 (-4)
Amsterdam 11 12 13 14 15 16 17 18 19 20 21 22 23 (+3)
Dublin 10 11 12 13 14 15 16 17 18 19 20 21 22 (+2)
16:13 $ meet 05-24
May 24, 2019
Here 08 09 10 11 12 13 14 15 16 17 18 19 20
Toronto 07 08 09 10 11 12 13 14 15 16 17 18 19 (-1)
Chicago 06 07 08 09 10 11 12 13 14 15 16 17 18 (-2)
Amsterdam 13 14 15 16 17 18 19 20 21 22 23 24 25 (+5)
Dublin 12 13 14 15 16 17 18 19 20 21 22 23 24 (+4)
16:13 $
HTH
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f164339%2ftimezone-conversion-by-command-line%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
It's 6pm in Taipei, what time is it here?
date --date='TZ="Asia/Taipei" 18:00'
Fri Jul 16 11:00:00 BST 2010
At 11am here in London, what time is it in Taipei?
TZ=Asia/Taipei date -d "11:00 BST"
Fri Jul 16 18:00:00 CST 2010
Strange, but the first way doesn't work for me:TZ=Europe/Moscow date --date='TZ="Asia/Taipei" 18:00'
Mon Mar 27 18:00:00 CST 2017
-- i.e. it just tells me the date in Taipei, not my local date for that time point. Although manpage says your method is correct. Am I missing something?..coreutils 8.26
, Arch Linux
– MarSoft
Mar 27 '17 at 1:45
add a comment |
It's 6pm in Taipei, what time is it here?
date --date='TZ="Asia/Taipei" 18:00'
Fri Jul 16 11:00:00 BST 2010
At 11am here in London, what time is it in Taipei?
TZ=Asia/Taipei date -d "11:00 BST"
Fri Jul 16 18:00:00 CST 2010
Strange, but the first way doesn't work for me:TZ=Europe/Moscow date --date='TZ="Asia/Taipei" 18:00'
Mon Mar 27 18:00:00 CST 2017
-- i.e. it just tells me the date in Taipei, not my local date for that time point. Although manpage says your method is correct. Am I missing something?..coreutils 8.26
, Arch Linux
– MarSoft
Mar 27 '17 at 1:45
add a comment |
It's 6pm in Taipei, what time is it here?
date --date='TZ="Asia/Taipei" 18:00'
Fri Jul 16 11:00:00 BST 2010
At 11am here in London, what time is it in Taipei?
TZ=Asia/Taipei date -d "11:00 BST"
Fri Jul 16 18:00:00 CST 2010
It's 6pm in Taipei, what time is it here?
date --date='TZ="Asia/Taipei" 18:00'
Fri Jul 16 11:00:00 BST 2010
At 11am here in London, what time is it in Taipei?
TZ=Asia/Taipei date -d "11:00 BST"
Fri Jul 16 18:00:00 CST 2010
edited Jan 17 '13 at 16:08
harrymc
262k14271578
262k14271578
answered Jul 16 '10 at 10:23
hendryhendry
9142917
9142917
Strange, but the first way doesn't work for me:TZ=Europe/Moscow date --date='TZ="Asia/Taipei" 18:00'
Mon Mar 27 18:00:00 CST 2017
-- i.e. it just tells me the date in Taipei, not my local date for that time point. Although manpage says your method is correct. Am I missing something?..coreutils 8.26
, Arch Linux
– MarSoft
Mar 27 '17 at 1:45
add a comment |
Strange, but the first way doesn't work for me:TZ=Europe/Moscow date --date='TZ="Asia/Taipei" 18:00'
Mon Mar 27 18:00:00 CST 2017
-- i.e. it just tells me the date in Taipei, not my local date for that time point. Although manpage says your method is correct. Am I missing something?..coreutils 8.26
, Arch Linux
– MarSoft
Mar 27 '17 at 1:45
Strange, but the first way doesn't work for me:
TZ=Europe/Moscow date --date='TZ="Asia/Taipei" 18:00'
Mon Mar 27 18:00:00 CST 2017
-- i.e. it just tells me the date in Taipei, not my local date for that time point. Although manpage says your method is correct. Am I missing something?.. coreutils 8.26
, Arch Linux– MarSoft
Mar 27 '17 at 1:45
Strange, but the first way doesn't work for me:
TZ=Europe/Moscow date --date='TZ="Asia/Taipei" 18:00'
Mon Mar 27 18:00:00 CST 2017
-- i.e. it just tells me the date in Taipei, not my local date for that time point. Although manpage says your method is correct. Am I missing something?.. coreutils 8.26
, Arch Linux– MarSoft
Mar 27 '17 at 1:45
add a comment |
This example is from http://www.pixelbeat.org/cmdline.html#dates
It gives the local time corresponding to 9AM on the west coast of the US,
accounting for differing day light savings transitions.
date --date='TZ="America/Los_Angeles" 09:00 next Fri'
Use tzselect to get the TZ. The PST format is ambiguous.
IST = Indian Standard Time and Irish Summer Time for example.
2
Didn't know abouttzselect
, thanks. If you enter wrong 'TZ' input you can get misleading results, e.g. TZ=London date Fri Jul 16 10:28:52 London 2010
– hendry
Jul 16 '10 at 10:29
add a comment |
This example is from http://www.pixelbeat.org/cmdline.html#dates
It gives the local time corresponding to 9AM on the west coast of the US,
accounting for differing day light savings transitions.
date --date='TZ="America/Los_Angeles" 09:00 next Fri'
Use tzselect to get the TZ. The PST format is ambiguous.
IST = Indian Standard Time and Irish Summer Time for example.
2
Didn't know abouttzselect
, thanks. If you enter wrong 'TZ' input you can get misleading results, e.g. TZ=London date Fri Jul 16 10:28:52 London 2010
– hendry
Jul 16 '10 at 10:29
add a comment |
This example is from http://www.pixelbeat.org/cmdline.html#dates
It gives the local time corresponding to 9AM on the west coast of the US,
accounting for differing day light savings transitions.
date --date='TZ="America/Los_Angeles" 09:00 next Fri'
Use tzselect to get the TZ. The PST format is ambiguous.
IST = Indian Standard Time and Irish Summer Time for example.
This example is from http://www.pixelbeat.org/cmdline.html#dates
It gives the local time corresponding to 9AM on the west coast of the US,
accounting for differing day light savings transitions.
date --date='TZ="America/Los_Angeles" 09:00 next Fri'
Use tzselect to get the TZ. The PST format is ambiguous.
IST = Indian Standard Time and Irish Summer Time for example.
answered Jul 16 '10 at 10:05
pixelbeatpixelbeat
88066
88066
2
Didn't know abouttzselect
, thanks. If you enter wrong 'TZ' input you can get misleading results, e.g. TZ=London date Fri Jul 16 10:28:52 London 2010
– hendry
Jul 16 '10 at 10:29
add a comment |
2
Didn't know abouttzselect
, thanks. If you enter wrong 'TZ' input you can get misleading results, e.g. TZ=London date Fri Jul 16 10:28:52 London 2010
– hendry
Jul 16 '10 at 10:29
2
2
Didn't know about
tzselect
, thanks. If you enter wrong 'TZ' input you can get misleading results, e.g. TZ=London date Fri Jul 16 10:28:52 London 2010– hendry
Jul 16 '10 at 10:29
Didn't know about
tzselect
, thanks. If you enter wrong 'TZ' input you can get misleading results, e.g. TZ=London date Fri Jul 16 10:28:52 London 2010– hendry
Jul 16 '10 at 10:29
add a comment |
I think this is closer to what the OP asked (Since he doesn't necessarily know that BST is Taipei? and the answer doesn't explain how to get to "Asia/Taipei" from 'BST').
First my current date:
$ date
Mon Apr 21 13:07:21 MDT 2014
Then the date I want to know:
$ date -d '5pm BST'
Mon Apr 21 15:00:00 MDT 2014
So I know that 5pm BST
is 2 hours away.
I usually forget if I have to add or remove two hours from EDT times so I have a little script with the common timezones I have to work with:
$ cat tz
#!/bin/bash
TZ='America/Edmonton' date
TZ='America/Chicago' date
TZ='America/New_York' date
And the output:
$ tz
Mon Apr 21 13:12:32 MDT 2014
Mon Apr 21 14:12:32 CDT 2014
Mon Apr 21 15:12:32 EDT 2014
Valid locations for your tz
script can be found here /usr/share/zoneinfo
.
But again, for times in the future I just use date -d '<time> <timezone>'
.
add a comment |
I think this is closer to what the OP asked (Since he doesn't necessarily know that BST is Taipei? and the answer doesn't explain how to get to "Asia/Taipei" from 'BST').
First my current date:
$ date
Mon Apr 21 13:07:21 MDT 2014
Then the date I want to know:
$ date -d '5pm BST'
Mon Apr 21 15:00:00 MDT 2014
So I know that 5pm BST
is 2 hours away.
I usually forget if I have to add or remove two hours from EDT times so I have a little script with the common timezones I have to work with:
$ cat tz
#!/bin/bash
TZ='America/Edmonton' date
TZ='America/Chicago' date
TZ='America/New_York' date
And the output:
$ tz
Mon Apr 21 13:12:32 MDT 2014
Mon Apr 21 14:12:32 CDT 2014
Mon Apr 21 15:12:32 EDT 2014
Valid locations for your tz
script can be found here /usr/share/zoneinfo
.
But again, for times in the future I just use date -d '<time> <timezone>'
.
add a comment |
I think this is closer to what the OP asked (Since he doesn't necessarily know that BST is Taipei? and the answer doesn't explain how to get to "Asia/Taipei" from 'BST').
First my current date:
$ date
Mon Apr 21 13:07:21 MDT 2014
Then the date I want to know:
$ date -d '5pm BST'
Mon Apr 21 15:00:00 MDT 2014
So I know that 5pm BST
is 2 hours away.
I usually forget if I have to add or remove two hours from EDT times so I have a little script with the common timezones I have to work with:
$ cat tz
#!/bin/bash
TZ='America/Edmonton' date
TZ='America/Chicago' date
TZ='America/New_York' date
And the output:
$ tz
Mon Apr 21 13:12:32 MDT 2014
Mon Apr 21 14:12:32 CDT 2014
Mon Apr 21 15:12:32 EDT 2014
Valid locations for your tz
script can be found here /usr/share/zoneinfo
.
But again, for times in the future I just use date -d '<time> <timezone>'
.
I think this is closer to what the OP asked (Since he doesn't necessarily know that BST is Taipei? and the answer doesn't explain how to get to "Asia/Taipei" from 'BST').
First my current date:
$ date
Mon Apr 21 13:07:21 MDT 2014
Then the date I want to know:
$ date -d '5pm BST'
Mon Apr 21 15:00:00 MDT 2014
So I know that 5pm BST
is 2 hours away.
I usually forget if I have to add or remove two hours from EDT times so I have a little script with the common timezones I have to work with:
$ cat tz
#!/bin/bash
TZ='America/Edmonton' date
TZ='America/Chicago' date
TZ='America/New_York' date
And the output:
$ tz
Mon Apr 21 13:12:32 MDT 2014
Mon Apr 21 14:12:32 CDT 2014
Mon Apr 21 15:12:32 EDT 2014
Valid locations for your tz
script can be found here /usr/share/zoneinfo
.
But again, for times in the future I just use date -d '<time> <timezone>'
.
edited Apr 21 '14 at 19:46
answered Apr 21 '14 at 19:18
DavidGDavidG
28126
28126
add a comment |
add a comment |
Use Wolfram Alpha. To the basic URL…
http://www.wolframalpha.com/input/?i=
append the conversion, with spaces replaced by +
. For example:
http://www.wolframalpha.com/input/?i=5+PM+CET+to+PST
Note that Wolfram Alpha does not seem to recognize BST
as a time zone.
how does one quickly look up time zone codes?
– hendry
Jul 16 '10 at 10:31
@hendry This is a cool interactive online map: timeanddate.com/time/map/#!cities=241
– DavidG
Apr 21 '14 at 19:48
add a comment |
Use Wolfram Alpha. To the basic URL…
http://www.wolframalpha.com/input/?i=
append the conversion, with spaces replaced by +
. For example:
http://www.wolframalpha.com/input/?i=5+PM+CET+to+PST
Note that Wolfram Alpha does not seem to recognize BST
as a time zone.
how does one quickly look up time zone codes?
– hendry
Jul 16 '10 at 10:31
@hendry This is a cool interactive online map: timeanddate.com/time/map/#!cities=241
– DavidG
Apr 21 '14 at 19:48
add a comment |
Use Wolfram Alpha. To the basic URL…
http://www.wolframalpha.com/input/?i=
append the conversion, with spaces replaced by +
. For example:
http://www.wolframalpha.com/input/?i=5+PM+CET+to+PST
Note that Wolfram Alpha does not seem to recognize BST
as a time zone.
Use Wolfram Alpha. To the basic URL…
http://www.wolframalpha.com/input/?i=
append the conversion, with spaces replaced by +
. For example:
http://www.wolframalpha.com/input/?i=5+PM+CET+to+PST
Note that Wolfram Alpha does not seem to recognize BST
as a time zone.
edited Jul 26 '12 at 10:05
slhck
162k47448471
162k47448471
answered Jul 16 '10 at 10:07
drizztdrizzt
1213
1213
how does one quickly look up time zone codes?
– hendry
Jul 16 '10 at 10:31
@hendry This is a cool interactive online map: timeanddate.com/time/map/#!cities=241
– DavidG
Apr 21 '14 at 19:48
add a comment |
how does one quickly look up time zone codes?
– hendry
Jul 16 '10 at 10:31
@hendry This is a cool interactive online map: timeanddate.com/time/map/#!cities=241
– DavidG
Apr 21 '14 at 19:48
how does one quickly look up time zone codes?
– hendry
Jul 16 '10 at 10:31
how does one quickly look up time zone codes?
– hendry
Jul 16 '10 at 10:31
@hendry This is a cool interactive online map: timeanddate.com/time/map/#!cities=241
– DavidG
Apr 21 '14 at 19:48
@hendry This is a cool interactive online map: timeanddate.com/time/map/#!cities=241
– DavidG
Apr 21 '14 at 19:48
add a comment |
I know it is an old thread, but I needed a code for the same use case and, based on the ideas here, developed this little bash script:
#!/bin/bash
# ig20180122 - displays meeting options in other time zones
# set the following variable to the start and end of your working day
myday="8 20" # start and end time, with one space
# set the local TZ
myplace='America/Sao_Paulo'
# set the most common places
place[1]='America/Toronto'
place[2]='America/Chicago' # Houston as well
place[3]='Europe/Amsterdam'
place[4]='Europe/Dublin'
# add cities using place[5], etc.
# set the date format for search
dfmt="%m-%d" # date format for meeting date
hfmt="+%B %e, %Y" # date format for the header
# no need to change onwards
format1="%-10s " # Increase if your cities are large
format2="%02d "
mdate=$1
if [[ "$1" == "" ]]; then mdate=`date "+$dfmt"`; fi
date -j -f "$dfmt" "$hfmt" "$mdate"
here=`TZ=$myplace date -j -f "$dfmt" +%z "$mdate"`
here=$((`printf "%g" $here` / 100))
printf "$format1" "Here"
printf "$format2" `seq $myday`
printf "n"
for i in `seq 1 "${#place[*]}"`
do
there=`TZ=${place[$i]} date -j -f "$dfmt" +%z "$mdate"`
there=$((`printf "%g" $there` / 100))
city[$i]=${place[$i]/*//}
tdiff[$i]=$(($there - $here))
printf "$format1" ${city[$i]}
for j in `seq $myday`
do
printf "$format2" $(($j+${tdiff[$i]}))
done
printf "(%+d)n" ${tdiff[$i]}
done
You can either use to check the time differences today or in a future date:
16:08 $ meet
January 22, 2019
Here 08 09 10 11 12 13 14 15 16 17 18 19 20
Toronto 05 06 07 08 09 10 11 12 13 14 15 16 17 (-3)
Chicago 04 05 06 07 08 09 10 11 12 13 14 15 16 (-4)
Amsterdam 11 12 13 14 15 16 17 18 19 20 21 22 23 (+3)
Dublin 10 11 12 13 14 15 16 17 18 19 20 21 22 (+2)
16:13 $ meet 05-24
May 24, 2019
Here 08 09 10 11 12 13 14 15 16 17 18 19 20
Toronto 07 08 09 10 11 12 13 14 15 16 17 18 19 (-1)
Chicago 06 07 08 09 10 11 12 13 14 15 16 17 18 (-2)
Amsterdam 13 14 15 16 17 18 19 20 21 22 23 24 25 (+5)
Dublin 12 13 14 15 16 17 18 19 20 21 22 23 24 (+4)
16:13 $
HTH
add a comment |
I know it is an old thread, but I needed a code for the same use case and, based on the ideas here, developed this little bash script:
#!/bin/bash
# ig20180122 - displays meeting options in other time zones
# set the following variable to the start and end of your working day
myday="8 20" # start and end time, with one space
# set the local TZ
myplace='America/Sao_Paulo'
# set the most common places
place[1]='America/Toronto'
place[2]='America/Chicago' # Houston as well
place[3]='Europe/Amsterdam'
place[4]='Europe/Dublin'
# add cities using place[5], etc.
# set the date format for search
dfmt="%m-%d" # date format for meeting date
hfmt="+%B %e, %Y" # date format for the header
# no need to change onwards
format1="%-10s " # Increase if your cities are large
format2="%02d "
mdate=$1
if [[ "$1" == "" ]]; then mdate=`date "+$dfmt"`; fi
date -j -f "$dfmt" "$hfmt" "$mdate"
here=`TZ=$myplace date -j -f "$dfmt" +%z "$mdate"`
here=$((`printf "%g" $here` / 100))
printf "$format1" "Here"
printf "$format2" `seq $myday`
printf "n"
for i in `seq 1 "${#place[*]}"`
do
there=`TZ=${place[$i]} date -j -f "$dfmt" +%z "$mdate"`
there=$((`printf "%g" $there` / 100))
city[$i]=${place[$i]/*//}
tdiff[$i]=$(($there - $here))
printf "$format1" ${city[$i]}
for j in `seq $myday`
do
printf "$format2" $(($j+${tdiff[$i]}))
done
printf "(%+d)n" ${tdiff[$i]}
done
You can either use to check the time differences today or in a future date:
16:08 $ meet
January 22, 2019
Here 08 09 10 11 12 13 14 15 16 17 18 19 20
Toronto 05 06 07 08 09 10 11 12 13 14 15 16 17 (-3)
Chicago 04 05 06 07 08 09 10 11 12 13 14 15 16 (-4)
Amsterdam 11 12 13 14 15 16 17 18 19 20 21 22 23 (+3)
Dublin 10 11 12 13 14 15 16 17 18 19 20 21 22 (+2)
16:13 $ meet 05-24
May 24, 2019
Here 08 09 10 11 12 13 14 15 16 17 18 19 20
Toronto 07 08 09 10 11 12 13 14 15 16 17 18 19 (-1)
Chicago 06 07 08 09 10 11 12 13 14 15 16 17 18 (-2)
Amsterdam 13 14 15 16 17 18 19 20 21 22 23 24 25 (+5)
Dublin 12 13 14 15 16 17 18 19 20 21 22 23 24 (+4)
16:13 $
HTH
add a comment |
I know it is an old thread, but I needed a code for the same use case and, based on the ideas here, developed this little bash script:
#!/bin/bash
# ig20180122 - displays meeting options in other time zones
# set the following variable to the start and end of your working day
myday="8 20" # start and end time, with one space
# set the local TZ
myplace='America/Sao_Paulo'
# set the most common places
place[1]='America/Toronto'
place[2]='America/Chicago' # Houston as well
place[3]='Europe/Amsterdam'
place[4]='Europe/Dublin'
# add cities using place[5], etc.
# set the date format for search
dfmt="%m-%d" # date format for meeting date
hfmt="+%B %e, %Y" # date format for the header
# no need to change onwards
format1="%-10s " # Increase if your cities are large
format2="%02d "
mdate=$1
if [[ "$1" == "" ]]; then mdate=`date "+$dfmt"`; fi
date -j -f "$dfmt" "$hfmt" "$mdate"
here=`TZ=$myplace date -j -f "$dfmt" +%z "$mdate"`
here=$((`printf "%g" $here` / 100))
printf "$format1" "Here"
printf "$format2" `seq $myday`
printf "n"
for i in `seq 1 "${#place[*]}"`
do
there=`TZ=${place[$i]} date -j -f "$dfmt" +%z "$mdate"`
there=$((`printf "%g" $there` / 100))
city[$i]=${place[$i]/*//}
tdiff[$i]=$(($there - $here))
printf "$format1" ${city[$i]}
for j in `seq $myday`
do
printf "$format2" $(($j+${tdiff[$i]}))
done
printf "(%+d)n" ${tdiff[$i]}
done
You can either use to check the time differences today or in a future date:
16:08 $ meet
January 22, 2019
Here 08 09 10 11 12 13 14 15 16 17 18 19 20
Toronto 05 06 07 08 09 10 11 12 13 14 15 16 17 (-3)
Chicago 04 05 06 07 08 09 10 11 12 13 14 15 16 (-4)
Amsterdam 11 12 13 14 15 16 17 18 19 20 21 22 23 (+3)
Dublin 10 11 12 13 14 15 16 17 18 19 20 21 22 (+2)
16:13 $ meet 05-24
May 24, 2019
Here 08 09 10 11 12 13 14 15 16 17 18 19 20
Toronto 07 08 09 10 11 12 13 14 15 16 17 18 19 (-1)
Chicago 06 07 08 09 10 11 12 13 14 15 16 17 18 (-2)
Amsterdam 13 14 15 16 17 18 19 20 21 22 23 24 25 (+5)
Dublin 12 13 14 15 16 17 18 19 20 21 22 23 24 (+4)
16:13 $
HTH
I know it is an old thread, but I needed a code for the same use case and, based on the ideas here, developed this little bash script:
#!/bin/bash
# ig20180122 - displays meeting options in other time zones
# set the following variable to the start and end of your working day
myday="8 20" # start and end time, with one space
# set the local TZ
myplace='America/Sao_Paulo'
# set the most common places
place[1]='America/Toronto'
place[2]='America/Chicago' # Houston as well
place[3]='Europe/Amsterdam'
place[4]='Europe/Dublin'
# add cities using place[5], etc.
# set the date format for search
dfmt="%m-%d" # date format for meeting date
hfmt="+%B %e, %Y" # date format for the header
# no need to change onwards
format1="%-10s " # Increase if your cities are large
format2="%02d "
mdate=$1
if [[ "$1" == "" ]]; then mdate=`date "+$dfmt"`; fi
date -j -f "$dfmt" "$hfmt" "$mdate"
here=`TZ=$myplace date -j -f "$dfmt" +%z "$mdate"`
here=$((`printf "%g" $here` / 100))
printf "$format1" "Here"
printf "$format2" `seq $myday`
printf "n"
for i in `seq 1 "${#place[*]}"`
do
there=`TZ=${place[$i]} date -j -f "$dfmt" +%z "$mdate"`
there=$((`printf "%g" $there` / 100))
city[$i]=${place[$i]/*//}
tdiff[$i]=$(($there - $here))
printf "$format1" ${city[$i]}
for j in `seq $myday`
do
printf "$format2" $(($j+${tdiff[$i]}))
done
printf "(%+d)n" ${tdiff[$i]}
done
You can either use to check the time differences today or in a future date:
16:08 $ meet
January 22, 2019
Here 08 09 10 11 12 13 14 15 16 17 18 19 20
Toronto 05 06 07 08 09 10 11 12 13 14 15 16 17 (-3)
Chicago 04 05 06 07 08 09 10 11 12 13 14 15 16 (-4)
Amsterdam 11 12 13 14 15 16 17 18 19 20 21 22 23 (+3)
Dublin 10 11 12 13 14 15 16 17 18 19 20 21 22 (+2)
16:13 $ meet 05-24
May 24, 2019
Here 08 09 10 11 12 13 14 15 16 17 18 19 20
Toronto 07 08 09 10 11 12 13 14 15 16 17 18 19 (-1)
Chicago 06 07 08 09 10 11 12 13 14 15 16 17 18 (-2)
Amsterdam 13 14 15 16 17 18 19 20 21 22 23 24 25 (+5)
Dublin 12 13 14 15 16 17 18 19 20 21 22 23 24 (+4)
16:13 $
HTH
answered Jan 22 at 18:14
Iuri GavronskiIuri Gavronski
1
1
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f164339%2ftimezone-conversion-by-command-line%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What do you mean exactly? Command line linux? Command you can type into Google? What?!
– Dal Hundal
Jul 16 '10 at 9:37
command line in shell and google's query box are both a command line to me
– hendry
Jul 16 '10 at 9:42
1
perhaps a better tool would do cities by airport codes, 5pm LHR in SFO
– hendry
Jul 16 '10 at 9:42
@hendry dateutils can do timezone conversion based on iata and icao airport codes:
dateconv 2017-05-16T17:00 --from-zone iata:SFO --zone iata:LHR
->2017-05-17T01:00:00
– hroptatyr
May 16 '17 at 9:10