LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Display the date and time from another time zone (https://www.linuxquestions.org/questions/linux-software-2/display-the-date-and-time-from-another-time-zone-211777/)

lothario 07-31-2004 06:05 AM

Display the date and time from another time zone
 
I am using Red Hat 9
I am in the PDT time zone.
The date command displays the current date and time correctly.

Once a week, I need to display the current date and time in the CDT time zone.

Can the date command be used to display the current date and time in the CDT time zone?

If yes, how?

If no, is there another way?

320mb 07-31-2004 09:20 AM

in a term window, you should be able to type this...........

tzselect

and answer a few questions.

homey 07-31-2004 10:48 AM

I found a neat little script here which seems easy enough. I added the date command at the bottom so it would display the date and zone which you selected.
like so....
Code:

#!/bin/bash
# Created by Ben Okopnik on Wed Nov 21 23:06:09 EST 2001
# Links '/etc/localtime' to appropriate TZ

[ $UID -gt 0 ] && { printf "You need to be root.\n"; exit; }

cd /usr/share/zoneinfo/US

PS3="Please select a timezone: "
select tz in *
do
        [ "$tz" = "" ] && {
                printf "Invalid choice; timezone not set.\n"
                exit
        }

        ln -sf $PWD/$tz /etc/localtime
        printf "The timezone is now US/$tz.\n"
        date
        exit
done


lothario 07-31-2004 01:49 PM

Thank you for the suggestions.

I just found out that the zdump command does the trick.

In my case it would be:
zdump America/Chicago

homey 07-31-2004 03:27 PM

Quote:

I just found out that the zdump command does the trick.
Every time I learn something, I'm told that makes a new wrinkle in the brain. And when you get old enough, they start to show on your face. Thanks for the new wrinkle. :)


All times are GMT -5. The time now is 08:06 PM.