Show date by terminal

Asked

Viewed 553 times

4

Just as you can change the linux date by the terminal in the format {month}{day}{time}{minute}{year}, all together, I wanted to know how to save the current date in a variable (Python), change the date and time with a terminal application and then change back to the date in the variable.

ex: date: Wed Nov 1 11:22:33 UTC 2015 need help showing: 11(November)1(day)11(hour)22(minute)15(year) without the "()"

  • 11(novembro)1(dia)11(hora)22(minuto)15(ano) without the parentheses 111112215. There aren’t any gaps missing there?

  • no, to change the date by the terminal is anyway, but the day is not "1" the right and '01"

  • Managed to solve your problem?

1 answer

2

Well, the manual of date is quite complete as to the format. In your case, I suggest the following command line:

date +"%d%m%H%M%G"

where in my terminal, provides the following output:

250211152016

P.S. Take a look at the manual of date to understand output formats

  • The answer didn’t seem appropriate. The question is clear: "Save the current date in a Python variable".

  • @Lacobus wow, retaliation. I like that. It goes on your resume here

Browser other questions tagged

You are not signed in. Login or sign up in order to post.