Unable to display the date-time in seconds on AIX


 
Thread Tools Search this Thread
Operating Systems AIX Unable to display the date-time in seconds on AIX
# 1  
Old 07-05-2006
Unable to display the date-time in seconds on AIX

Hi,

In unix the command "date +%s" displays the date-time in seconds since â00:00:00 1970-01-01 UTCâ (a GNU extension)
when executed on unix:
-sh-2.05b$ date +%s
1152092690

I tried with all the format control output but unable to display the date-time in seconds i,e as in unix format. Can anybody tell me how to display date-time in seconds on AIX or give me the equivalent command as in unix.

Thanks,
Haroon
# 2  
Old 07-05-2006
Try man date. I think you want %S instead of %s.
# 3  
Old 07-10-2006
Hi,

I have tried with all options using man date, but i am not able to display the time on the screen in desired format.
I require date to be displayed in the given format below:

1145470369 - i,e Specifies the time (in seconds) since the epoch (00:00:00 GMT, January 1, 1970).

Thanks,
Haroon
# 4  
Old 07-10-2006
date +%s works fine for me on my AIX 5.3 machine. What is the output when you give this command?
# 5  
Old 07-10-2006
Hi,

When i tried "date +%s" on my AIX 5.1 , it displays %s .

Thanks,
Haroon

Last edited by me_haroon; 07-11-2006 at 05:08 AM..
# 6  
Old 07-11-2006
Are some alternate commands available

Hi,

The command date +%s is not available for AIX 5.1, but available in AIX 5.3. CAn any one plese tell me some combination of commands that will do the job of date +%s on AIX 5.1.

Its an urgent issue please help me.

Thanks,
Haroon
# 7  
Old 07-11-2006
Would perl do?
Code:
 #!/usr/bin/perl
$mytime=time;
print "$mytime\n";

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Time in seconds on AIX 4.3.2.0

Hi to everybody again i Need your help, i wasting hours but can't find a solutuin for my Problem. I am not an expert with AIX script programming. I have a csh script and i need the time in seconds but since i have an old AIX the Option -%s doesnot exist with the date command. I seach in Google... (13 Replies)
Discussion started by: Nadielosabra
13 Replies

2. UNIX for Dummies Questions & Answers

Condition based on Timestamp (Date/Time based) from logfile (Epoch seconds)

Below is the sample logfile: Userids Date Time acb Checkout time: 2013-11-20 17:00 axy Checkout time: 2013-11-22 12:00 der Checkout time: 2013-11-17 17:00 xyz Checkout time: 2013-11-19 16:00 ddd Checkout time: 2013-11-21 16:00 aaa Checkout... (9 Replies)
Discussion started by: asjaiswal
9 Replies

3. UNIX for Dummies Questions & Answers

Display Date and Time in GDB

In gdb is there any way we can display date/time in first column while debugging or is there any command which will print date/time? I am asking this just to know when exactly a breakpoint got hit. (6 Replies)
Discussion started by: rupeshkp728
6 Replies

4. Shell Programming and Scripting

How to display yesterday Date in AIX

Hi, I need help to display the yesterday date in format mentioned below: 2012-06-26-PMI tried this but it displays current date: `date +%Y-%m-%d-%p` (9 Replies)
Discussion started by: aroragaurav.84
9 Replies

5. Shell Programming and Scripting

Script to capture date/time in seconds in PERL... Cant understand errors

I'm Using this script to find the time of a file. I'm very much new to PERL and found this script posted by some one on this forum. It runs perfectly fine, just that it gives me following errors with the accurate output as well. I jus want the output to be stored in another file so that i can... (0 Replies)
Discussion started by: bankimmehta
0 Replies

6. UNIX for Dummies Questions & Answers

How to always display date/time regardless of directory?

I found via Google a way to show the date and time stamp once I log in. However, whenever I cd to another directory it doesn't display the correct path. Here are the relevant parts from my .kshrc : unset _h _m _s eval $(date "+_h=%H ;_m=%M ;_s=%S") ((SECONDS =... (3 Replies)
Discussion started by: Mike F.
3 Replies

7. Shell Programming and Scripting

date and time to display on the terminal

hi all, am trying to 'grep' some text from a log file and use the 'cut' command to read from that line i just grep'ed to extract date/time and response times. code sniplet i am using is : grep -i 'text to grep' Out.log | while read LINE; do ... (11 Replies)
Discussion started by: cesarNZ
11 Replies

8. Shell Programming and Scripting

how to display time in minutes n seconds...

Hi all, may i know how to display time in minutes and seconds(may be milliseconds and even smaller that ) in shell scripts.... (1 Reply)
Discussion started by: santy
1 Replies

9. Solaris

display date n Time

Hi Friends, Can any one guide me regarding 'Display the date and time' command other than the command 'date' thanks n regards SsRrIi (1 Reply)
Discussion started by: SsRrIi
1 Replies

10. UNIX for Dummies Questions & Answers

Script to display last login date/time?

I was wondering if anyone had a script that would display the last time a user logged into a particular machine. I know about the "last" command, but it gives too much info.... I just wanted to know the last time a user used his/her id. ANy help would be greatly appreciated. Ryan (3 Replies)
Discussion started by: ryaneverett5
3 Replies
Login or Register to Ask a Question