How To Get Today’s Date?

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/get-todays-date/
PINTEREST
PINTEREST
INSTAGRAM

Getting current date time information is very different for different systems and programming languages. We will look this simple but big issue for vast majority of operating systems and programming languages.

Linux/FreeBSD/Unix

We can date information from GUI panel clock but we will look for command line. We will issue date command to get current date and time. Linux date format have a lot of options. Alternatively we can call these as unix date or bash date examples.

We can provide parameters to get only time partition from date command.

We can get current year month day like below

We can use ready to use parameters like +%F which will list year-month-day

We can use +%D to get date according to locale settings

Windows

Windows date function which is provided by DOS operating system is very simple and lean. We only set or get date with date function

Python

Python is a scripting language and to get current date time information python function in a code file can be used. Alternative is python interpreter. In this example we will use interpreter.

We can get time information with %I:%M format string parameters.

LEARN MORE  How To Allow Normal User Run Commands As Root In Linux?

We get get year, month and day as string like below

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/get-todays-date/
PINTEREST
PINTEREST
INSTAGRAM

Leave a Reply

Your email address will not be published.