954,546 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How can i display time 5mins ago on Solaris 10

Hi

Im writing a script where im using the date command in this format.

[Datestart=`date '+%m/%d/%Y':'%H:%M:%S'`]

Is their a way to force the date variable above to go back 5minutes??

I know their is a way in perl but i prefer writing this script in ksh

skelly16
Light Poster
34 posts since Aug 2007
Reputation Points: 10
Solved Threads: 0
 
$ date '+%m/%d/%Y':'%H:%M:%S' ; date --date='now -5 minutes' '+%m/%d/%Y':'%H:%M:%S'
08/26/2009:18:25:41
08/26/2009:18:20:41
Salem
Posting Sage
Team Colleague
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
 

Hi Salem

Tried that on Solaris 10

[date '+%m/%d/%Y':'%H:%M:%S' ; date --date='now -5 minutes' '+%m/%d/%Y':'%H:%M:%S'
09/01/2009:11:11:30
date: illegal option -- date=now -5 minutes
usage: date [-u] mmddHHMM[[cc]yy][.SS]
date [-u] [+format]
date -a [-]sss[.fff]
]

skelly16
Light Poster
34 posts since Aug 2007
Reputation Points: 10
Solved Threads: 0
 

Looks like you've got a crappy date then, and you need to use the perl way you know.

Salem
Posting Sage
Team Colleague
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You