- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Scripting for time zone
Operating System - HP-UX
1819984
Members
4035
Online
109608
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-04-2011 01:14 AM
тАО05-04-2011 01:14 AM
Hi,
Can anyone help in creating a shell script for time zone conversion?
My requirement is that: the script will run on the server and take out the Time Zone (let us suppose it is CDT) and i wanted it to be converted this CDT time(it should always be 1 P.M) in GMT +5:30 through script. Whatever the timing zones of server i just wanted to convert it in GMT +5:30
For Example- the current time on server is 11:00 P.M. CDT so i wanted to know whats the timings in GMT +5:30 when the server timing is 1:00PM CDT, i mean 1 P.M. CDT is equal to what in GMT +5:30 through script.
Can anyone help in creating a shell script for time zone conversion?
My requirement is that: the script will run on the server and take out the Time Zone (let us suppose it is CDT) and i wanted it to be converted this CDT time(it should always be 1 P.M) in GMT +5:30 through script. Whatever the timing zones of server i just wanted to convert it in GMT +5:30
For Example- the current time on server is 11:00 P.M. CDT so i wanted to know whats the timings in GMT +5:30 when the server timing is 1:00PM CDT, i mean 1 P.M. CDT is equal to what in GMT +5:30 through script.
Solved! Go to Solution.
- Tags:
- Time Zone
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-04-2011 03:02 AM
тАО05-04-2011 03:02 AM
Solution
Hi:
# TZ=EST5EDT date
# TZ=UTC date
# TZ=PST8PDT date
...will establish a timezone for the duration of the command line since there is no semicolon (';') after the TZ variable setting.
You can do this in a script and capture the result, too:
# MYTIME=$(TZ=PST8PDT date)
# echo ${MYTIME}
Regards!
...JRF...
# TZ=EST5EDT date
# TZ=UTC date
# TZ=PST8PDT date
...will establish a timezone for the duration of the command line since there is no semicolon (';') after the TZ variable setting.
You can do this in a script and capture the result, too:
# MYTIME=$(TZ=PST8PDT date)
# echo ${MYTIME}
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-04-2011 11:22 AM
тАО05-04-2011 11:22 AM
Re: Scripting for time zone
JRF has shown you how to convert the current time to IST: TZ=IST-5:30 date
If you want to convert arbitrary times, you'll need to write a C/C++ program or use perl.
If you want to convert arbitrary times, you'll need to write a C/C++ program or use perl.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Learn About
News and Events
Support
© Copyright 2025 Hewlett Packard Enterprise Development LP