1# date<a name="EN-US_TOPIC_0000001134006248"></a> 2 3- [Command Function](#section56472016338) 4- [Syntax](#section16635112512316) 5- [Parameters](#section15896030039) 6- [Usage](#section116361036636) 7- [Example](#section021711411237) 8- [Output](#section17950184414312) 9 10## Command Function<a name="section56472016338"></a> 11 12This command is used to query and set the system date and time. 13 14## Syntax<a name="section16635112512316"></a> 15 16date 17 18date --help 19 20date +\[_Format_\] 21 22date -s_ _\[_YY/MM/DD_\] 23 24date_ _-s_ _\[_hh:mm:ss_\]__ 25 26date -r \[_Filename_\] 27 28## Parameters<a name="section15896030039"></a> 29 30**Table 1** Parameter description 31 32<a name="table3825mcpsimp"></a> 33<table><thead align="left"><tr id="row3831mcpsimp"><th class="cellrowborder" valign="top" width="21%" id="mcps1.2.4.1.1"><p id="p3833mcpsimp"><a name="p3833mcpsimp"></a><a name="p3833mcpsimp"></a>Parameter</p> 34</th> 35<th class="cellrowborder" valign="top" width="50%" id="mcps1.2.4.1.2"><p id="p3835mcpsimp"><a name="p3835mcpsimp"></a><a name="p3835mcpsimp"></a>Description</p> 36</th> 37<th class="cellrowborder" valign="top" width="28.999999999999996%" id="mcps1.2.4.1.3"><p id="p3837mcpsimp"><a name="p3837mcpsimp"></a><a name="p3837mcpsimp"></a>Value Range</p> 38</th> 39</tr> 40</thead> 41<tbody><tr id="row3838mcpsimp"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.2.4.1.1 "><p id="p3840mcpsimp"><a name="p3840mcpsimp"></a><a name="p3840mcpsimp"></a>--help</p> 42</td> 43<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.4.1.2 "><p id="p3842mcpsimp"><a name="p3842mcpsimp"></a><a name="p3842mcpsimp"></a>Displays the help information.</p> 44</td> 45<td class="cellrowborder" valign="top" width="28.999999999999996%" headers="mcps1.2.4.1.3 "><p id="p3844mcpsimp"><a name="p3844mcpsimp"></a><a name="p3844mcpsimp"></a>N/A</p> 46</td> 47</tr> 48<tr id="row3845mcpsimp"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.2.4.1.1 "><p id="p3847mcpsimp"><a name="p3847mcpsimp"></a><a name="p3847mcpsimp"></a>+Format</p> 49</td> 50<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.4.1.2 "><p id="p3849mcpsimp"><a name="p3849mcpsimp"></a><a name="p3849mcpsimp"></a>Prints the date and time based on <strong id="b3850mcpsimp"><a name="b3850mcpsimp"></a><a name="b3850mcpsimp"></a>Format</strong>.</p> 51</td> 52<td class="cellrowborder" valign="top" width="28.999999999999996%" headers="mcps1.2.4.1.3 "><p id="p3852mcpsimp"><a name="p3852mcpsimp"></a><a name="p3852mcpsimp"></a>Placeholders listed in <strong id="b14613228303338"><a name="b14613228303338"></a><a name="b14613228303338"></a>--help</strong>.</p> 53</td> 54</tr> 55<tr id="row3853mcpsimp"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.2.4.1.1 "><p id="p3855mcpsimp"><a name="p3855mcpsimp"></a><a name="p3855mcpsimp"></a>-s YY/MM/DD</p> 56</td> 57<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.4.1.2 "><p id="p3857mcpsimp"><a name="p3857mcpsimp"></a><a name="p3857mcpsimp"></a>Sets the system date and separates the year, month, and day by slashes (/).</p> 58</td> 59<td class="cellrowborder" valign="top" width="28.999999999999996%" headers="mcps1.2.4.1.3 "><p id="p3859mcpsimp"><a name="p3859mcpsimp"></a><a name="p3859mcpsimp"></a>>= 1970/01/01</p> 60</td> 61</tr> 62<tr id="row3860mcpsimp"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.2.4.1.1 "><p id="p3862mcpsimp"><a name="p3862mcpsimp"></a><a name="p3862mcpsimp"></a>-s hh:mm:ss</p> 63</td> 64<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.4.1.2 "><p id="p3864mcpsimp"><a name="p3864mcpsimp"></a><a name="p3864mcpsimp"></a>Sets the system time and separates the hour, minute, and second by colons (:).</p> 65</td> 66<td class="cellrowborder" valign="top" width="28.999999999999996%" headers="mcps1.2.4.1.3 "><p id="p3866mcpsimp"><a name="p3866mcpsimp"></a><a name="p3866mcpsimp"></a>N/A</p> 67</td> 68</tr> 69<tr id="row3867mcpsimp"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.2.4.1.1 "><p id="p3869mcpsimp"><a name="p3869mcpsimp"></a><a name="p3869mcpsimp"></a>-r Filename</p> 70</td> 71<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.4.1.2 "><p id="p3871mcpsimp"><a name="p3871mcpsimp"></a><a name="p3871mcpsimp"></a>Queries the modification time of the <strong id="b12095159793338"><a name="b12095159793338"></a><a name="b12095159793338"></a>Filename</strong> file.</p> 72</td> 73<td class="cellrowborder" valign="top" width="28.999999999999996%" headers="mcps1.2.4.1.3 "><p id="p3873mcpsimp"><a name="p3873mcpsimp"></a><a name="p3873mcpsimp"></a>N/A</p> 74</td> 75</tr> 76</tbody> 77</table> 78 79## Usage<a name="section116361036636"></a> 80 81- If the **date** parameter is not specified, the current system date and time are displayed by default. 82- The **--help**, **+Format**, **-s**, and **-r** parameters are mutually exclusive. 83 84## Example<a name="section021711411237"></a> 85 86Example: 87 88Run **date +%Y--%m--%d**. 89 90## Output<a name="section17950184414312"></a> 91 92**Figure 1** System date printed based on the specified format<a name="fig152576304517"></a> 93 94 95