With a recent version of ksh (on a system that doesn't have a GNU date utility) in a terminal session where the default timezone is the US Pacific timezone, the following:
produces the output:
So, with a GNU date utility on a Linux system using a recent bash, the following might work:
If the timezone being used in your terminal session is already set to use US Central time zone, you can drop the TZ=CST6CDT at the start of the date command line.
PS: Note that a timestamp of 0740 GMT will NOT convert to a timestamp of 10:30:00 CST; with the given date, it would either convert to 2017-04-27 01:40:00 CST or, if you aren't in the parts of Indiana that don't observe daylight saving time, 2017-04-27 02:40:00 CDT. Getting this date format would need the date format string:
instead of:
Last edited by Don Cragun; 04-27-2017 at 02:51 AM..
Reason: Fix date utility format string and add PS.
hi friends,
this is my first time with this type of script so please pardon my ignorance. i have this script in which a piece of code needs to be added which can have the Asia/Hong kong time as well. system date and format is GMT so no problem with GMT and even EST is covered..i have ato add new... (5 Replies)
I have a file named "suspected" with series of line like these :
{'protocol': 17, 'service': 'BitTorrent KRPC', 'server': '219.78.120.166', 'client_port': 52044, 'client': '10.64.68.44', 'server_port': 8291, 'time': 1226506312L, 'serverhostname': ''}
{'protocol': 17, 'service': 'BitTorrent... (3 Replies)
Hi guys,
I know that this topic has been discuss numerous times, and I have search the net and this forum for it.
However, non able to address the problem I faced so far.
I am on Solaris Platform and unable to install additional packages like the GNU date and gawk to make use of their... (5 Replies)
Hi, I need to convert a date in the format
yyyy-mm-dd to unix seconds, shell script or perl would be ok
since there is no hour/second, we can assume 12am every day
thanks in advance
funksen (4 Replies)
Hi,
I need to convert a number representing time in UTC seconds to a date. Ex:
3BE0082C --> Oct 31 2001 15:31:08
I have tried the following perl command but it gives a different answer?
$ perl -e 'print scalar localtime(shift), "\n"' 3BE00B2C
Thu Jan 1 03:00:03 1970
Any ideas? Thanks. :) (10 Replies)
Hi,
Is there any easy way to convert date time(stored in shell variable ) to epoch time in solaris box? As +%s is working on linux but not on solaris, also -d option is not working.
Any suggestion please? (6 Replies)
Looking for some help and usually when I do a search this site comes up. Hopefully someone can give me a little direction as to how to use one of these two commands to achieve what I'm trying to do.
What am I trying to do?
I need to take the time value in epoch format returned from the... (5 Replies)
Hello Team,
I am stuck in getting the required output in the following case. Please help.
My input file is
aa|08/01/2016
bb|08/15/2016
I wish to convert the file into
aa|epoch time
bb|epoch time
I am using following code: (3 Replies)
Hi,
I have a data file where the timestamp is in the style of:
2016-10-11 07:01:23.375-500
which is yyyy-mm-dd hh-mm-ss-000 then time conversion from UTC
What i need to do is convert these timestamps from the above format to a the Serial Date format (i.e 42,654.2920446 )
now.. if... (14 Replies)
Discussion started by: AshBax
14 Replies
LEARN ABOUT SUNOS
rtc
rtc(1M) System Administration Commands rtc(1M)NAME
rtc - provide all real-time clock and GMT-lag management
SYNOPSIS
/usr/sbin/rtc [-c] [-z zone-name]
DESCRIPTION
On x86 systems, the rtc command reconciles the difference in the way that time is established between UNIX and MS-DOS systems. UNIX systems
utilize Greenwich Mean Time (GMT), while MS-DOS systems utilize local time.
Without arguments, rtc displays the currently configured time zone string. The currently configured time zone string is based on what was
last recorded by rtc-z zone-name.
The rtc command is not normally run from a shell prompt; it is generally invoked by the system. Commands such as date(1) and rdate(1M),
which are used to set the time on a system, invoke /usr/sbin/rtc -c to ensure that daylight savings time (DST) is corrected for properly.
OPTIONS -c This option checks for DST and makes corrections if necessary. It is normally run once a day by a cron job.
If there is no RTC time zone or /etc/rtc_config file, this option will do nothing.
-z zone-name This option, which is normally run by the system at software installation time, is used to specify the time zone in which
the RTC is to be maintained. It updates the configuration file /etc/rtc_config with the name of the specified zone and the
current GMT lag for that zone. If there is an existing rtc_config file, this command will update it. If not, this command
will create it.
FILES
/etc/rtc_config The data file used to record the time zone and GMT lag. This file is completely managed by /usr/sbin/rtc, and it is
read by the kernel.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Architecture |x86 |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
SEE ALSO date(1), rdate(1M), attributes(5)SunOS 5.10 3 Oct 2003 rtc(1M)