LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 07-31-2004, 06:05 AM   #1
lothario
Member
 
Registered: Apr 2004
Posts: 340

Rep: Reputation: 30
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?
 
Old 07-31-2004, 09:20 AM   #2
320mb
Senior Member
 
Registered: Nov 2002
Location: pikes peak
Distribution: Slackware, LFS
Posts: 2,577

Rep: Reputation: 47
in a term window, you should be able to type this...........

tzselect

and answer a few questions.
 
Old 07-31-2004, 10:48 AM   #3
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 56
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
 
Old 07-31-2004, 01:49 PM   #4
lothario
Member
 
Registered: Apr 2004
Posts: 340

Original Poster
Rep: Reputation: 30
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
 
Old 07-31-2004, 03:27 PM   #5
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 56
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Start Date + Time Duration = End Date/Time calculator? ToBe Linux - General 3 09-26-2005 10:17 AM
Time Zone cherukuri_sr Linux - Newbie 2 02-02-2005 11:20 AM
Setting System Time: kernel in wrong time zone warrenweiss Linux - General 7 05-15-2004 03:25 PM
KDE time zone changes don't know what to do shad061 Mandriva 2 02-02-2004 10:10 PM
time zone exigent Linux - General 4 09-17-2002 03:41 PM


All times are GMT -5. The time now is 05:40 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration