Sponsored Content
Full Discussion: Timestamp format in HP-UX
Top Forums UNIX for Advanced & Expert Users Timestamp format in HP-UX Post 303018764 by rbatte1 on Thursday 14th of June 2018 12:48:50 PM
Old 06-14-2018
You would be best looking at the stat command to get the information you want in the format you want. The output of ls is slightly fickle. If a file is older than 6 months it may display a day/month/year rather than a day.month/time which might confused your process.

Using stat and the appropriate flags, you can build the time in a suitably portable way.

Have a go and let us know if you get stuck and we will try to help you.




Kind regards,
Robin
This User Gave Thanks to rbatte1 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to convert from timestamp to date format in tcsh

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. UNIX for Advanced & Expert Users

get the timestamp of a file in desired format

Hi, I have a file say abc. I get the timestamp in following way: ls -ltr abc | awk -F" " '{print $6,$7,$8}' Mar 8 10:23 I need to get the timestamp as : 03-08-2007 10:23:00 Thanks Sumeet (1 Reply)
Discussion started by: sumeet
1 Replies

3. Programming

converting unix timestamp into readable format using c++

hi everyone, im new here and am in desperate need of help. I want to convert my 32 bit unix time stamp ' 45d732f6' into a readable format (Sat, 17 February 2007 16:53:10 UTC) using c++. I have looked around the interent but i just cant make sense of anything. All examples i can find just... (3 Replies)
Discussion started by: uselessprog
3 Replies

4. UNIX for Advanced & Expert Users

ls -l timestamp display format

The time stamp format using "ls -l" is either mmm dd hh:mm or mmm dd yyyy. For later case, how can I know the hh:mm as well. Thanks. (3 Replies)
Discussion started by: pok.fung
3 Replies

5. Shell Programming and Scripting

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,... (11 Replies)
Discussion started by: girish.raos
11 Replies

6. AIX

Convert unix timestamp to year month day format ?

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

7. UNIX for Dummies Questions & Answers

Format/Fix Timestamp Data in a File.

Hello Experts, I have a timestamp(6) column in a .csv data file , format of the data is as below:- ETCT,P,Elec, Inc.,abc,11/5/2010 4:16:09.000000 PM,Y,Y,Y I want the timestamp column to be properly formatted like 11/05/2010 04:16:09.000000 PM Currently the "0" is missing with... (3 Replies)
Discussion started by: mtlrsk
3 Replies

8. Shell Programming and Scripting

Getting file timestamp in certain format

Hi all, I'm a Unix newbie and I need to get file timestamp in the following format: YYYYMMDD HH24:MM:SS example: 20120713 18:49:30 For start I've tried the following code, but I don't know how to display the year and even format the date: ls -l $filename | awk '{print $7 $6 $8}' My... (4 Replies)
Discussion started by: Braun
4 Replies

9. Shell Programming and Scripting

Convert UNIX timestamp to readable format in the file

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

10. Shell Programming and Scripting

Convert date in dd mm yyyy format to UNIX timestamp

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
IP-MONITOR(8)							       Linux							     IP-MONITOR(8)

NAME
ip-monitor, rtmon - state monitoring SYNOPSIS
ip monitor [ all | OBJECT-LIST ] [ file FILENAME ] [ label ] [ all-nsid ] [ dev DEVICE ] OPTIONS
-t, -timestamp Prints timestamp before the event message on the separated line in format: Timestamp: <Day> <Month> <DD> <hh:mm:ss> <YYYY> <usecs> usec <EVENT> -ts, -tshort Prints short timestamp before the event message on the same line in format: [<YYYY>-<MM>-<DD>T<hh:mm:ss>.<ms>] <EVENT> DESCRIPTION
The ip utility can monitor the state of devices, addresses and routes continuously. This option has a slightly different format. Namely, the monitor command is the first in the command line and then the object list follows: ip monitor [ all | OBJECT-LIST ] [ file FILENAME ] [ label ] [ all-nsid ] [ dev DEVICE ] OBJECT-LIST is the list of object types that we want to monitor. It may contain link, address, route, mroute, prefix, neigh, netconf, rule and nsid. If no file argument is given, ip opens RTNETLINK, listens on it and dumps state changes in the format described in previous sec- tions. If the label option is set, a prefix is displayed before each message to show the family of the message. For example: [NEIGH]10.16.0.112 dev eth0 lladdr 00:04:23:df:2f:d0 REACHABLE [LINK]3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN group default link/ether 52:54:00:12:34:57 brd ff:ff:ff:ff:ff:ff If the all-nsid option is set, the program listens to all network namespaces that have a nsid assigned into the network namespace were the program is running. A prefix is displayed to show the network namespace where the message originates. Example: [nsid 0]10.16.0.112 dev eth0 lladdr 00:04:23:df:2f:d0 REACHABLE If the file option is given, the program does not listen on RTNETLINK, but opens the given file, and dumps its contents. The file should contain RTNETLINK messages saved in binary format. Such a file can be generated with the rtmon utility. This utility has a command line syntax similar to ip monitor. Ideally, rtmon should be started before the first network configuration command is issued. F.e. if you insert: rtmon file /var/log/rtmon.log in a startup script, you will be able to view the full history later. Nevertheless, it is possible to start rtmon at any time. It prepends the history with the state snapshot dumped at the moment of starting. If the dev option is given, the program prints only events related to this device. SEE ALSO
ip(8) AUTHOR
Original Manpage by Michail Litvak <mci@owl.openwall.com> Manpage revised by Nicolas Dichtel <nicolas.dichtel@6wind.com> iproute2 13 Dec 2012 IP-MONITOR(8)
All times are GMT -4. The time now is 11:34 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy