hello, how to get time to see what time is now in linux command prompt? simply:
But i need with no spaces and colons… i use all mighty sed 🙂
$ date
Mon May 10 15:56:05 EEST 2010
Hurray!?! No! I still need something else: YYYY-MM-DD HH:mm:ss howto get it? simply:
$ date | sed 's/\ /_/g' | sed 's/:/-/g'
Mon_May_10_15-56-31_EEST_2010
$ date +%Y-%m-%d\ %H:%M:%S
How to set the date? simply:
2010-05-10 15:57:01
$ date +%Y-%m-%d.%H:%M:%S -s "2010-05-03.12:56:01"
$ date
Mon May 3 12:56:05 EEST 2010
for setting up time you can simply get ntp (network time protocol) to sync your clock with pool severs 😉
One reply on “date – getting time to your needs”
naveikia