How to find the router reboot date using script?

Hai

Iam having router output in a text file.from this data how to find out the router reboot date and time using script

 [local]bgl-ras-bng-bge-09>show version | grep Time
Router Up Time -   61 days, 21 hours 31 minutes 49 secs

[local]bgl-ras-bng-bge-09>show clock
Thu Feb 14 10:16:14 2013 IST

output date should come with below formula

Thu Feb 14 10:16:14 2013 IST    -   61 days, 21 hours 31 minutes 49 secs = ROUTER REBOOT DATE with TIME. 

can any body help. tnx in advance.

date --date='Thu Feb 14 10:16:14 2013 IST - 61 days 21 hours 31 minutes 49 secs'

Hi its not working.below error coming

# date --date='Thu Feb 14 10:16:14 2013 IST - 61 days 21 hours 31 minutes 49 secs' 

output

 date: illegal option -- date=Thu Feb 14 10:16:14 2013 IST - 61 days 21 hours 31 minutes 49 secs
usage:  date [-u] mmddHHMM[[cc]yy][.SS]
        date [-u] [+format]
        date -a [-]sss[.fff]


-d is a GNU-only option.

From this we can tell you probably don't have linux.

If you don't, what do you have?

Hi

Iam using solaris 10 OS server.

# Get the current time, minus 300 seconds 
DATE=$(perl -e 'use POSIX qw(strftime);  print strftime "%m %d %H %M %S\n", localtime(time()+$ARGV[0]);' -- -300 )

Now there's just the challenge of getting the number of seconds out of that string. I'm guessing it may vary, not printing days if it hasn't been up days, etc... hmm...

OLDIFS="$IFS"
IFS="${IFS},"

set -- `show version | grep Time`

IFS="$OLDIFS"

while [ "$#" -gt 0 ] && [ "$1" != "-" ] ; do shift ; done

shift

S=0

while [ "$#" -gt 0 ]
do
        case "$2" in
        day*) let S=S+${1}*60*60*24 ;;
        hour*) let S=S+${1}*60*60 ;;
        minute*) let S=S+${1}*60 ;;
        second*) let S=S+${1} ;;
        esac

        shift 2
done

DATE=$(perl -e 'use POSIX qw(strftime);  print strftime "%m %d %H %M %S\n", localtime(time()+$ARGV[0]);' -- -${S} )

Adjust strftime to taste by changing its format string, see man strftime, it takes the same options.