{"id":102,"date":"2022-08-26T14:41:13","date_gmt":"2022-08-26T09:11:13","guid":{"rendered":"https:\/\/vpswebhostingindia.com\/blog\/?p=102"},"modified":"2022-08-26T14:41:13","modified_gmt":"2022-08-26T09:11:13","slug":"date-command-in-linux","status":"publish","type":"post","link":"https:\/\/vpswebhostingindia.com\/blog\/date-command-in-linux\/","title":{"rendered":"Date Command in Linux"},"content":{"rendered":"\n<p><strong>date&nbsp;<\/strong>command is used to display the system date and time. date command is also used to set date and time of the system.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1.&nbsp;<strong>date<\/strong>&nbsp;<strong>(no option)<\/strong><\/h3>\n\n\n\n<p>With no options, the date command displays the current date and time, including the abbreviated day name, abbreviated month name, day of the month, the time separated by colons, the time zone name, and the year.&nbsp;<\/p>\n\n\n\n<h4 class=\"has-text-align-left wp-block-heading\">                                                                                 <em><strong>$ date<\/strong><\/em><\/h4>\n\n\n\n<p>Example:<\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"320\" height=\"39\" data-id=\"104\" src=\"https:\/\/vpswebhostingindia.com\/blog\/wp-content\/uploads\/2022\/08\/date-1.png\" alt=\"\" class=\"wp-image-104\" srcset=\"https:\/\/vpswebhostingindia.com\/blog\/wp-content\/uploads\/2022\/08\/date-1.png 320w, https:\/\/vpswebhostingindia.com\/blog\/wp-content\/uploads\/2022\/08\/date-1-300x37.png 300w\" sizes=\"auto, (max-width: 320px) 100vw, 320px\" \/><\/figure>\n<\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">2. <strong>-u Option<\/strong><\/h3>\n\n\n\n<p>Displays the time in GMT(Greenwich Mean Time)\/UTC(Coordinated Universal Time )time zone.&nbsp;<\/p>\n\n\n\n<h4 class=\"has-text-align-left wp-block-heading\">                                                                             $ date -u<\/h4>\n\n\n\n<p>Example:<\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-2 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"243\" height=\"40\" data-id=\"105\" src=\"https:\/\/vpswebhostingindia.com\/blog\/wp-content\/uploads\/2022\/08\/date-u.png\" alt=\"\" class=\"wp-image-105\"\/><\/figure>\n<\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">3. <strong>Using \u2013date option for displaying past dates:<\/strong><\/h3>\n\n\n\n<p>the below command used for to display the past dates like yesterday, 2 weeks ago, 3 months ago date.<\/p>\n\n\n\n<h4 class=\"has-text-align-left wp-block-heading\">                                                                             $ date &#8211;date=&#8221;yesterday&#8221;<\/h4>\n\n\n\n<h4 class=\"has-text-align-left wp-block-heading\">                                                                             $ date &#8211;date=&#8221;2 year ago&#8221;<\/h4>\n\n\n\n<p>Example:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/vpswebhostingindia.com\/blog\/wp-content\/uploads\/2022\/08\/yesterday.png\" alt=\"\" class=\"wp-image-106\" width=\"851\" height=\"84\" srcset=\"https:\/\/vpswebhostingindia.com\/blog\/wp-content\/uploads\/2022\/08\/yesterday.png 387w, https:\/\/vpswebhostingindia.com\/blog\/wp-content\/uploads\/2022\/08\/yesterday-300x29.png 300w\" sizes=\"auto, (max-width: 851px) 100vw, 851px\" \/><\/figure>\n<\/div>\n\n\n<h3 class=\"wp-block-heading\">4. <strong>Using \u2013date option for displaying future date:&nbsp;<\/strong><\/h3>\n\n\n\n<p>It displays Date and time of upcoming particular week day.&nbsp;<\/p>\n\n\n\n<h4 class=\"has-text-align-left wp-block-heading\">                                                                             $ date &#8211;date=&#8221;next mon&#8221;<\/h4>\n\n\n\n<h4 class=\"has-text-align-left wp-block-heading\">                                                                             $ date &#8211;date=&#8221;10 day&#8221;<\/h4>\n\n\n\n<p>Example:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/vpswebhostingindia.com\/blog\/wp-content\/uploads\/2022\/08\/next-mon.png\" alt=\"\" class=\"wp-image-107\" width=\"838\" height=\"84\" srcset=\"https:\/\/vpswebhostingindia.com\/blog\/wp-content\/uploads\/2022\/08\/next-mon.png 358w, https:\/\/vpswebhostingindia.com\/blog\/wp-content\/uploads\/2022\/08\/next-mon-300x30.png 300w\" sizes=\"auto, (max-width: 838px) 100vw, 838px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">5. <strong>-s or \u2013set Option:&nbsp;<\/strong><\/h3>\n\n\n\n<p>To set the system date and time -s or \u2013set option is used.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">                                                                          $ date &#8211;set=&#8221;set the date&#8221;<\/h4>\n\n\n\n<p>Example: <\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-3 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"519\" height=\"37\" data-id=\"108\" src=\"https:\/\/vpswebhostingindia.com\/blog\/wp-content\/uploads\/2022\/08\/set-date.png\" alt=\"\" class=\"wp-image-108\" srcset=\"https:\/\/vpswebhostingindia.com\/blog\/wp-content\/uploads\/2022\/08\/set-date.png 519w, https:\/\/vpswebhostingindia.com\/blog\/wp-content\/uploads\/2022\/08\/set-date-300x21.png 300w\" sizes=\"auto, (max-width: 519px) 100vw, 519px\" \/><\/figure>\n<\/figure>\n","protected":false},"excerpt":{"rendered":"<p>date&nbsp;command is used to display the system date and time. date command is also used to set date and time of the system. 1.&nbsp;date&nbsp;(no option) With no options, the date command displays the current date and time, including the abbreviated day name, abbreviated month name, day of the month, the time separated by colons, the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-102","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/vpswebhostingindia.com\/blog\/wp-json\/wp\/v2\/posts\/102","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vpswebhostingindia.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vpswebhostingindia.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vpswebhostingindia.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vpswebhostingindia.com\/blog\/wp-json\/wp\/v2\/comments?post=102"}],"version-history":[{"count":3,"href":"https:\/\/vpswebhostingindia.com\/blog\/wp-json\/wp\/v2\/posts\/102\/revisions"}],"predecessor-version":[{"id":112,"href":"https:\/\/vpswebhostingindia.com\/blog\/wp-json\/wp\/v2\/posts\/102\/revisions\/112"}],"wp:attachment":[{"href":"https:\/\/vpswebhostingindia.com\/blog\/wp-json\/wp\/v2\/media?parent=102"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vpswebhostingindia.com\/blog\/wp-json\/wp\/v2\/categories?post=102"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vpswebhostingindia.com\/blog\/wp-json\/wp\/v2\/tags?post=102"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}