|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi Folks,
My server time is in EDT. And i am sending automated mails from that server in which i need to display the current date time as per IST (GMT+5:30). Please advice how to display the date time as per IST. IST time leads 9:30 mins to EDT. and i wrote something like below. timestamp=`date --date='+9 hour 30 minutes' '+%d/%b/%y %r'` But The EDT time difference changes to 10 hrs on change of Daylight in every 6 months. How to dynamically do that.. Please Advice. Thx in Advance... ![]() |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
What about using the TZ variable. Not sure it would help with that daylight saving problem; you may need to schedule a cron job to adapt TZ every 6 months.
|
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
I would have tried the crontab . But its not a fixed date on which the day light saving lag happens...
.Many Thanks for ur Quick response. |
|
#4
|
|||
|
|||
|
Since India does not waste time with daylight saving time shifts, just setting TZ=IST-5:30 will give you the correct time in India at any time of year. For example, a few seconds ago: Code:
TZ=GMT0 date;TZ=IST-5:30 date produced the output: Code:
Sat Mar 16 11:10:49 GMT 2013 Sat Mar 16 16:40:49 IST 2013 |
| The Following User Says Thank You to Don Cragun For This Useful Post: | ||
chidori (03-16-2013) | ||
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
Thanks Don,
Worked perfectly. |
| Sponsored Links | |
|
|
#6
|
|||
|
|||
|
Quote:
|
| Sponsored Links | |
|
|
#7
|
|||
|
|||
|
Quote:
Code:
$ TZ=PST8PDT $ date;TZ=IST-5:30 date;date Sat Mar 16 07:13:53 PDT 2013 Sat Mar 16 19:43:53 IST 2013 Sat Mar 16 07:13:53 PDT 2013 $ echo $TZ PST8PDT $ |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Adding hours and minutes to current date (Only to date not to time) | manojgarg | UNIX for Dummies Questions & Answers | 4 | 08-22-2012 10:50 AM |
| How far is given date from current time? | SkySmart | Shell Programming and Scripting | 2 | 06-14-2012 12:06 AM |
| compare file modification date/time to current date/time | Bill Ma | Shell Programming and Scripting | 5 | 08-27-2009 12:02 PM |
| problem with displaying date and adding time | FuncMx | Shell Programming and Scripting | 1 | 10-10-2008 12:06 AM |
| Get date and time for past 1 hour from current date | spch2o | Shell Programming and Scripting | 5 | 08-29-2008 04:32 AM |
|
|