09-04-2009
To convert a date(in string format) to unix timestamp
Hi All,
I have a string like below.
"Mar 31 2009" .
I want to convert this to unix time .
Also please let me know how to find the unix time for the above string minus one day. For Eg. if i have string "Mar 31 2009" i want to find the unix time stamp of "Mar 30 2009".
Thanks in advance,
Giri
---------- Post updated at 05:36 AM ---------- Previous update was at 04:56 AM ----------
Can anyone please respond for this ?
Thanks,
Giri
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hello all
im looking for fast way to convert timestamp format to date format
and vaiseversa in tcsh , can it be done?
thanks allot (2 Replies)
Discussion started by: umen
2 Replies
2. Shell Programming and Scripting
Dear Experts,
I need your help to convert a unix date and time format number in to readable format like dd/mm/yyyy .
I have a text file of more than 10,000 records and it is like
NAME DATE1 COUNTRY DATE2
ABD 1223580395699 USA 1223580395699... (3 Replies)
Discussion started by: shary
3 Replies
3. AIX
Hello,
How do I convert unix timestamp value to 'normal' date format - to get year month and day values ?
Looks like it's easy to do using GNU date (linux systems). But how do I do tthis on AIX ?
I don't want to write C program, any ways to do that using unix shells ?
thanks (1 Reply)
Discussion started by: vilius
1 Replies
4. Shell Programming and Scripting
Dear Expert
How to convert date in format of YYYY-MM-DD HH:MM:SS to unix format
using a script or command if avaliable
Example
"2011-05-15 18:00:00" is converted to 1330970400
I tried to use option d in date command but no use, Im using solaris 10
Thanks a lot (12 Replies)
Discussion started by: yahyaaa
12 Replies
5. AIX
hello,
i have an AIX5.3 machine and i am writing a script to display some processes.
inside the script i want to get the time that the process starts and convert it to a unix timestamp.
is there a command that i can use to do that? i search the web but all i found is long scripts and it does... (4 Replies)
Discussion started by: omonoiatis9
4 Replies
6. Shell Programming and Scripting
Hi,
I am getting the below string as a input for date.
12/03/2013 11:02 AM
I want to change this date as 03-DEC-2013 11:02 AM.
Could you please help on this.
Thanks
Chelladurai (4 Replies)
Discussion started by: ckchelladurai
4 Replies
7. Shell Programming and Scripting
Hello I have a file : file1.txt with the below contents :
237176 test1 test2 1442149024
237138 test3 test4 1442121300
237171 test5 test7 1442112823
237145 test9 test10 1442109600
In the above file fourth field represents the timestamp in Unix format.
I found a command which converts... (6 Replies)
Discussion started by: rahul2662
6 Replies
8. Shell Programming and Scripting
Hello All,
I have a date in DD/MM/YYYY format. I am trying to convert this into unix timestamp. I have tried following:
date -d $mydate +%s
where mydate = 23/12/2016 00:00:00
I am getting following error:
date: extra operand `+%s'
Try `date --help' for more information.
... (1 Reply)
Discussion started by: angshuman
1 Replies
9. Shell Programming and Scripting
Hi All
I need help in converting a string of YYYYMMDD format to date in Sun OS and then find out if the day is a Wednesday or not. The "date -d" option is not working and your help is much appreciated.
The date command usage from the operating system we use here is as follows:
usage: ... (1 Reply)
Discussion started by: SK123
1 Replies
10. Solaris
Hi All
I need help in converting a string of YYYYMMDD format to date in Sun OS and then find out if the day is a Wednesday or not. The "date -d" option is not working and your help is much appreciated.
The date command usage from the operating system we use here is as follows:
Thanks,
SK (11 Replies)
Discussion started by: SK123
11 Replies
NTP(8) System Manager's Manual NTP(8)
NAME
ntp - query an ntp clock
SYNOPSIS
ntp [-v] [-s] [-f] hosts...
DESCRIPTION
ntp sends an ntp packet to the ntp daemon running on each of the given hosts. A daemon fills in fields of the ntp packet as per RFC-????
and sends the packet back. ntp then formats and prints the result on the standard output.
The default output shows the delay, offset, and date in ctime() format.
Options can reset the time of the local system clock.
OPTIONS
-v Verbose output, showing the full contents of received ntp packets, plus caluclated offset, displacement, etc.
-s Set system time-of-day clock. Will only happen if time offset is less than compiled-in constant WAYTOBIG (currently 1000 seconds).
Will not happen if remote host is unsynchronized.
-f Force setting system clock regardless of offset. Must be used with -s option. Still will not reset clock if remote system is
unsynchronized.
NTP RESULTS
The default output for each host looks like this:
128.8.10.1: delay:1.845207 offset:-0.358460 Mon Mar 20 08:05:44 1989
The verbose output for each host looks like this:
Packet from: [128.8.10.1]
Leap 0, version 1, mode Server, poll 6, precision -10 stratum 1 (WWVB)
Synch Distance is 0000.1999 0.099991
Synch Dispersion is 0000.0000 0.000000
Reference Timestamp is a7bea6c3.88b40000 Tue Mar 7 14:06:43 1989
Originate Timestamp is a7bea6d7.d7e6e652 Tue Mar 7 14:07:03 1989
Receive Timestamp is a7bea6d7.cf1a0000 Tue Mar 7 14:07:03 1989
Transmit Timestamp is a7bea6d8.0ccc0000 Tue Mar 7 14:07:04 1989
Input Timestamp is a7bea6d8.1a77e5ea Tue Mar 7 14:07:04 1989
umd1: delay:0.019028 offset:-0.043890 Tue Mar 7 14:07:04 1989
The various fields are interpreted as follows:
Packet from: [address]
The address that this ntp packet was received from.
Leap indicator: n
The leap second indicator. Non-zero if there is to be a leap second added or subtracted at the new year.
Status: n
Stratum: n (source)
The stratum of the clock in the NTP hierarchy, along with the source of the clock, either the name of a reference standard (such as
WWVB or GOES) or the Internet address of the clock that this clock is derived from.
Poll = n
The desired poll rate of the peer.
Precision = exponent (dec)
The claimed precision of the clock, in seconds.
Synchronizing Dist is ???
Synchronizing Dispersion is ???
The next five timestamps are given as NTP fixed-point values, in both hexadecimal and ctime(3). These are set either by this ntp process,
or by the server we are quering.
Reference Timestamp is hex-timestamp ctime string
The last time the server clock was adjusted. (remote time)
Originate Timestamp is hex-timestamp ctime string
When the ntp request was transmitted by us to the server. (local time)
Receive Timestamp is hex-timestamp ctime string
When the ntp request was received at the server. (remote time)
Transmit Timestamp is hex-timestamp ctime string
When the ntp response was transmitted by the server. (remote time)
Input Timestamp is hex-timestamp ctime string
When the ntp response was received by us. (local time)
hostname: delay:time offset:time
The summary of the results of the query, giving the hostname of the responding clock (from the command line), the round-trip delay,
and the offset between the two clocks (assuming symmetric round-trip times).
BUGS
Using ntp with the current host will show inaccurate results.
Probably a few others. Report bugs to Louis A. Mamokos (louie@trantor.umd.edu).
SEE ALSO
RFC-???? Network Time Protocol(1), Dave Mills and ...
ntpd(8), ntpdc(8)
30 July 1988 NTP(8)