The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > OS Specific Forums > HP-UX
Google UNIX.COM
Home Forums Register Rules & FAQ Members List Arcade Search Today's Posts Mark Forums Read


HP-UX HP-UX (Hewlett Packard UniX) is Hewlett-Packard's proprietary implementation of the Unix operating system, based on System V.


Other UNIX.COM Threads You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
help with while loop or any other alternative? filthymonk Shell Programming and Scripting 3 04-17-2008 11:19 PM
Alternative of format date in HP unix epall UNIX for Dummies Questions & Answers 2 09-29-2007 10:56 PM
Using awk (or an alternative) michaeltravisuk Shell Programming and Scripting 5 03-08-2007 07:37 PM
.NET Alternative goon12 UNIX for Dummies Questions & Answers 3 04-06-2005 09:07 AM
cut -f (or awk alternative) gefa Shell Programming and Scripting 6 03-02-2005 09:26 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-25-2008
Registered User
 

Join Date: Feb 2008
Posts: 7
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Alternative to date +%s

Hi,

My version of HP-UX does not support "date +%s" to find the number of seconds elapsed since 01/01/1970.

It would be great if anyone can give some simpler ideas for achieving the same.

Thanks.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 03-25-2008
Cameron's Avatar
Registered User
 

Join Date: Nov 2001
Location: Brisbane, Australia
Posts: 487
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
If 'date +%s' provides you the result you need, why search for an alternative ??

Sorry - curious to know why you'd seek an alternative. BTW - What OS are you using ??
Reply With Quote
  #3 (permalink)  
Old 03-26-2008
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,206
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
See: HP-UX & need help with time
Reply With Quote
  #4 (permalink)  
Old 03-26-2008
Registered User
 

Join Date: Apr 2002
Location: Dallas, TX
Posts: 53
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
You could try installing GNU's date command. It has a %s option and some other really cool features that once you install you'll want to keep forever. To get it, install GNU's coreutils on a test server and then copy just the date command over. I usually rename it to gdate so that HP's date program is still intact.
Reply With Quote
  #5 (permalink)  
Old 03-26-2008
Registered User
 

Join Date: Feb 2008
Posts: 7
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
I use HP-UX and it does not support "date +%s".

My basic requirement is that I need to find the difference (number of days) between two dates. My idea was to convert the dates to seconds. date +%s -d <date> gives the number of seconds elapsed since 01/01/1970 to the current date. Thus I can get both the dates in seconds & then find difference and then convert it back to days.

But the problem here that as I said earlier, HP-UX does not support date +%s. And I need this to be strictly in ksh and not in perl.

Any help on this will be highly appreciated.

Thanks.
Reply With Quote
Google UNIX.COM
Reply



Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -7. The time now is 02:45 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger

Search Engine Optimization by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102