date command in linux with flags | Pro Tech guides

date command in linux with flags

date command in linux allows you to display date and time in your linux terminal. You can also change the date and time by using some flags.

date command in linux with flags | examples

date command in linux with flags
date command in linux with flags

Hello guys, In this session, you will see how you can use the "date" command in Linux.

The "date" command is used to display or change the value of system time and date information.


date command

date command in linux
simple date command

$date
The "date" command is simple you can just write "date" and press ENTER.

It's going to "display" you the current date and time.

Change date and time using [-s] flag

date command with -s flag
date command with -s flag

$date -s [date] [time]

If you want to change the date and time then you have to use "-s" flag with the "date" command.

You can just say date -s "08/03/2020 05:34:00" press ENTER.

After this "-s" whatever date and time you will set inside a string it will be set as a system time.


Formatting Date and Time using flags

Flags which you can use with this "date" command to format the date and time.
FormatOutput
+%mShow the months in numerical format
+%hShow the months in character form (Jan-Dec)
+%BShow the months in character form (January-December)
+%dTo print the day of the month
+%yTo show the current year
+%TShow time as (hh:mm:ss)
+%H,+%M and +%Sprints Hour, Minutes and Seconds
+%DTo Display Date, Month and Year (dd/mm/yy)
date and time formating in linux using date command with various flags
Formatting date and time using various flags

$date flag
You can also use single quotes (') or double quotes (") with these flags.

Another way to print Date and Time

print date and time using date command
Example

$date "+DATE: %d-%m-%y%n TIME %H:%M:%S"
So in this way you can use the "date" command in Linux.

Conclusion

To know more about the "date" command just go through this man page and see how you can use this "date" command because it's a vast command.

So just read this man page whenever you want to write.

I hope you have enjoyed this tutorial, Thank You.

HAVE A NICE DAY💓

Related,
Name

Apps,3,Games,1,Linux,38,Linux Commands,37,Network-Devices,1,Networking,1,Terminal Apps,2,Termux,17,Userland,3,Windows,1,
ltr
item
Pro Tech guides: date command in linux with flags
date command in linux with flags
date command in linux allows you to display date and time in your linux terminal. You can also change the date and time by using some flags.
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7b8v6Tbt14mGl2hmX3l6ty7udDUE_wJwbvoiqQHvVjAQ8QUSMRBr0pbG2iqeIWyfEvINY9p72rz0WXfVvWNmb2gp-9yyQS4GsfrPaWwf7xGrQ295If37uguFKeJO8kTQ0r7TVKv_fILQ/s16000/linux-command-date.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7b8v6Tbt14mGl2hmX3l6ty7udDUE_wJwbvoiqQHvVjAQ8QUSMRBr0pbG2iqeIWyfEvINY9p72rz0WXfVvWNmb2gp-9yyQS4GsfrPaWwf7xGrQ295If37uguFKeJO8kTQ0r7TVKv_fILQ/s72-c/linux-command-date.png
Pro Tech guides
https://devops-digest.blogspot.com/2021/03/date-command-in-linux-with-flags.html
https://devops-digest.blogspot.com/
https://devops-digest.blogspot.com/
https://devops-digest.blogspot.com/2021/03/date-command-in-linux-with-flags.html
true
7053638852026728047
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy Table of Content