Sponsored Content
Top Forums Shell Programming and Scripting Displaying current date time of EDT in IST time Post 302781369 by chidori on Saturday 16th of March 2013 09:56:03 AM
Old 03-16-2013
Quote:
Originally Posted by Don Cragun
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

wow..!! , i did not know that shell has the ability to treat first one as variable assignment and next one it expands into a command. Thats a new thing i learnt today. Thank you
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

param as current date+time

Hi All, I need to pass param on aix "errpt -a -s MMDDHHMMYY -e MMDDHHMMYY". How do I read the date+time on the system and pass it as parameter? I need also the -s as previous day and the -e as current day. Thanks, itik (1 Reply)
Discussion started by: itik
1 Replies

2. Shell Programming and Scripting

Get date and time for past 1 hour from current date

Hi, I need to get the date and time for past 1 hour from the current date. Anyone know how to do so? Thanks (5 Replies)
Discussion started by: spch2o
5 Replies

3. Shell Programming and Scripting

problem with displaying date and adding time

Hi, I have a log file with contents like 81.49.74.131 - - 81.49.74.131 - - 116.112.52.31 - - 116.112.52.31 - - I need an output like this 81.49.74.131 14/Sep/2008 Time duration: 00:06:00 116.112.52.31 15/Sep/2008 Time duration: 00:00:01 Please anyone suggest a script for this.... (1 Reply)
Discussion started by: FuncMx
1 Replies

4. Solaris

changing time zone from ist to bst

Hi, Can anybody tell me how to change time zone from ist to bst, What changes should be done in /etc/TIMEZONE file. wheather it is possible to change timezone without rebooting the server. Regards Manoj (1 Reply)
Discussion started by: manoj.solaris
1 Replies

5. Shell Programming and Scripting

Prefix the current date and time to the output of ps

Hi, I need to write a script, that will take the current date, time, and the output from # ps -eo pid,tid,class,rtprio,ni,pri,psr,pcpu,stat,wchan:14,comm and spit it to a file, so it'll look like this... PID TID CLS RTPRIO NI PRI PSR %CPU STAT WCHAN COMMAND 1 1 TS... (2 Replies)
Discussion started by: Bloke
2 Replies

6. Shell Programming and Scripting

How far is given date from current time?

give a date and time: Jun 12 21:05:16 06-12-2012 21:05:16 2012/06/12 21:05:16 How can i subtract these dates and times from the current date and time and get back the difference in seconds? a one liner like: echo "Jun 12 21:05:16" | some perl/awk programming 90900s (2 Replies)
Discussion started by: SkySmart
2 Replies

7. UNIX for Dummies Questions & Answers

Adding hours and minutes to current date (Only to date not to time)

Hi, I want to add some hours and minutes to the current date. For example, if the current date is "July 16, 2012 15:20", i want to add 5 hours 30 minutes to "July 16, 2012 00:00" not to "July 16, 2012 15:20". Please help. Thanks! (4 Replies)
Discussion started by: manojgarg
4 Replies

8. Shell Programming and Scripting

Add current date and time

i have file 1.txt asdas|csada|13|03|10|04|23|A1|canberra sdasd|sfdsf|13|04|26|23|28|A1|sydney i want to add today's date and time in the end of each row expected output asdas|csada|13|03|10|04|23|A1|canberra|130430|1358 sdasd|sfdsf|13|04|26|23|28|A1|sydney|130430|1358 todays date... (10 Replies)
Discussion started by: radius
10 Replies

9. Shell Programming and Scripting

Need to substract date with current date and time

I have below file which contain the date in column 3,4,5 12345 open 10/10/13 10:08 PM 3 application is in java 67899 open 12/10/13 2:31 AM 2 apps can be reach 23456 open 11/9/13 2:31 AM 4 java is OK 65432 open 12/10/13 10:07 PM 9 we are... (1 Reply)
Discussion started by: vijay_rajni
1 Replies

10. UNIX for Beginners Questions & Answers

Getting the current time from a website and parsing date

I am trying to work on a script to grab the UTC time from a website So far I was able to cobble this together. curl -s --head web-url | grep ^Date: | sed 's/Date: //g' Which gives me the result I need. Wed, 06 Dec 2017 21:43:50 GMT What I need to is extract the 21:43:50 and convert... (4 Replies)
Discussion started by: allisterB
4 Replies
TZ(5)								File Formats Manual							     TZ(5)

NAME
TZ - Time zone environment variable SYNOPSIS
TZ=zone[-]offset[dst[offset][,start[/time],end[/time]]] DESCRIPTION
The TZ environment variable tells functions such as the ctime(3) family and programs like date what the time zone and daylight saving rule is. The value of TZ has the POSIX standardized form shown in the synopsis. This form specifies the zone names, offsets from GMT, and day- light savings changeover times for at least the current year. zone A three or more letter name for the time zone in normal (winter) time. [-]offset A signed time telling the offset of the time zone westwards from Greenwich. The time has the form hh[:mm[:ss]] with a one of two digit hour, and optional two digit minutes and seconds. dst The name of the time zone when daylight savings is in effect. It may be followed by an offset telling how big the clock correction is other than the default of 1 hour. start/time,end/time Specifies the start and end of the daylight savings period. The start and end fields indicate on what day the changeover occurs. They must be in one of the following formats: Jn The Julian day n (1 <= n <= 365) ignoring leap days, i.e. there is no February 29. n The zero-based Julian day (0 <= n <= 365). Leap days are not ignored. Mm.n.d This indicates month m, the n-th occurrence of day d (1 <= m <= 12, 1 <= n <= 5, 0 <= d <= 6, 0=Sunday). The 5-th occurrence means the last occurrence of that day in a month. So M4.1.0 is the first Sunday in April, M9.5.0 is the last Sunday in Septem- ber. The time field indicates the time the changeover occurs on the given day. EXAMPLES
Greenwich Mean Time: TZ=GMT0 Middle European Time, 1 hour east from Greenwich, daylight savings starts on the last Sunday in March at 2 AM and ends on the last Sunday in October at 3 AM: TZ='MET-1MET DST,M3.5.0/2,M10.5.0/3' British time, daylight savings starts and ends at the same moment as MET, but in an earlier time zone: TZ=GMT0BST,M3.5.0/1,M10.5.0/2 The eastern european time zones also have the changeovers at the same absolute time as British time and MET. U.S. Eastern Standard Time, 5 hours west from Greenwich, daylight savings starts on the first Sunday in April at 2 AM and ends on the last Sunday in October at 2 AM: TZ=EST5EDT,M4.1.0/2,M10.5.0/2 It shouldn't surprise you that daylight savings in New Zealand is observed in the months opposite from the previous examples. It starts on the first Sunday in October at 2 AM and ends on the third Sunday in March at 3 AM: TZ=NZST-12NZDT,M10.1.0/2,M3.3.0/3 SEE ALSO
readclock(8), date(1). BUGS
You may have noticed that many fields are optional. Do no omit them, because the defaults are bogus. If you need daylight savings then fully specify the changeovers. West is negative, east is positive, ask any sailor. AUTHOR
Kees J. Bot (kjb@cs.vu.nl) TZ(5)
All times are GMT -4. The time now is 12:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy