Editing Date (command)

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
{{lowercase}}
+
<code>date</code> command allows to print or set the system date and time.
<code>date</code><ref>http://man7.org/linux/man-pages/man1/date.1.html</ref> command allows to print or set the system date and [[time]].
 
  
  
== Linux Basic Examples ==
+
== Basic Examples ==
 
+
<pre>
$date -I or date [[--iso-8601]]
+
$ date -d now
2020-01-28
+
Wed Aug 18 16:47:31 EDT 2019
 
 
date '+%Y-%m-%d_%H%M'
 
2023-10-11_1350
 
 
 
date --[[iso-8601]]=minutes
 
2020-07-07T08:32+04:00
 
 
 
date --iso-8601=seconds
 
2014-03-19T16:51:16-0600
 
 
 
$date [[--rfc-3339]]=date
 
2020-01-28
 
  
$ date -d now
+
$ date -d today
Wed Aug 18 16:47:31 EDT 2019
+
Wed Aug 18 16:47:32 EDT 2019
 
$ date -d [[today]]
 
Wed Aug 18 16:47:32 EDT 2019
 
  
<pre>
 
 
$ date -d yesterday
 
$ date -d yesterday
 
Tue Aug 17 16:47:33 EDT 2019
 
Tue Aug 17 16:47:33 EDT 2019
Line 42: Line 25:
 
$ date +%b
 
$ date +%b
 
Aug  
 
Aug  
 
$date "+%b %d"
 
Aug 28
 
  
 
$ date +%B
 
$ date +%B
Line 55: Line 35:
 
2020-11-22_12:18-UTC
 
2020-11-22_12:18-UTC
  
$date --rfc-3339=date
 
2020-01-28
 
</pre>
 
  
[[date -r]]
+
MacOS:
 +
$ date +%F_-%T
 +
2020-08-03_-09:14:54
  
== macOS Examples ==
+
</pre>
 
 
date +%F
 
2021-07-18
 
 
 
date +%F-%T
 
2020-08-03-09:14:54
 
 
 
date '+%Y/%m/%d %H:%M:%S'
 
2021/07/18 16:32:26
 
 
 
[[date +%s]]
 
1655753367
 
 
 
== [[Cisco IOS]] ==
 
* <code>[[show clock]]</code>
 
  
 
== Activities ==
 
== Activities ==
 
# Read <code>date</code> man page: http://man7.org/linux/man-pages/man1/date.1.html
 
# Read <code>date</code> man page: http://man7.org/linux/man-pages/man1/date.1.html
# [[Prepend]] <code>date</code> output at the beginning of each line: <code>cat your_file.txt | [[while read]] i; do echo "$(date) $i"; done</code>
 
  
== Related ==
 
* <code>[[datetime]]</code> https://docs.python.org/3/library/datetime.html
 
* <code>[[ts]]</code> (<code>[[apt install moreutils]]</code>)
 
  
 
== See also ==
 
== See also ==
* {{date}}
 
* {{logging}}
 
* [[Cisco IOS]]: <code>[[show clock]]</code>
 
  
  
 
[[Category:Linux]]
 
[[Category:Linux]]

Please note that all contributions to wikieduonline may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see Wikieduonline:Copyrights for details). Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)

Templates used on this page:

Advertising: