Can someone help me to convert the date format after get it from the "LAST REBOOT" command.

Can someone help me to convert the date format after get it from the "LAST REBOOT" command.

these is the standard output.
bash-3.00# last reboot
reboot system boot Fri Aug 6 15:07
reboot system down Fri Aug 6 15:04
reboot system boot Wed Jul 14 16:12
reboot system down Tue Jul 6 20:04
reboot system boot Tue Jul 6 19:59
reboot system down Fri May 7 10:22
reboot system boot Fri May 7 10:01
wtmp begins Fri May 7 10:01
bash-3.00#

But.. I want
reboot system boot 2010-08-06 15:07
reboot system down 2010-08-06 15:04
reboot system boot 2010-08-06 16:12
reboot system down 2010-08-06 20:04
reboot system boot 2010-08-05 19:59
reboot system down 2010-08-05 10:22
reboot system boot 2010-08-06 10:01

Is it posible?

check the faq article: http://www.unix.com/answers-frequently-asked-questions/13785-yesterdays-date-date-arithmetic.html

should find what you're after
or use the search functionality...

trying "date conversion" brought up many hits including

Enjoy :wink:

1 Like

Thank you for reply, Tytalus

Actually i have researched the fucntion date and it is workable, but my problem in this acticle is converting the date when call the last reboot command.
when I execute the "last reboot > last_reboot.txt" it is plain text. there are no YEAR in the text, so I cannot connvert the plain text without YEAR.

the data in the plain text
reboot system boot Fri Aug 6 15:07
reboot system down Fri Aug 6 15:04
reboot system boot Wed Jul 14 16:12
reboot system down Tue Jul 6 20:04
reboot system boot Tue Jul 6 19:59
reboot system down Fri May 7 10:22
reboot system boot Fri May 7 10:01
wtmp begins Fri May 7 10:01

My question have resolved. my partner sent this URL to me. It can help someone who needs the output like me. :slight_smile:

General Solaris 10 Discussion - Unix last command does not dispay year