• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# date
2
3
4## Command Function
5
6This command is used to query the system date and time.
7
8
9## Syntax
10
11- date
12
13- date --help
14
15- date +[_Format_]
16
17- date -u
18
19
20## Parameters
21
22**Table 1** Parameter description
23
24| Parameter   | Description                      | Value Range              |
25| ------- | ------------------------------ | ---------------------- |
26| --help  | Displays help information.                    | N/A                    |
27| +Format | Prints the date and time in the specified format.| Placeholders listed in **--help**|
28| -u      | Displays UTC (not the current time zone).       | N/A                    |
29
30
31## Usage Guidelines
32
33- If no parameter is specified, the system date and time in UTC format are displayed by default.
34
35- The **--help**, **+Format**, and **-u** parameters are mutually exclusive.
36
37- Currently, this command cannot be used to set the time or date.
38
39## Note
40
41The shell does not support **date -u**. mksh supports it. To switch to mksh, run **cd bin** and **./mksh**.
42
43## Example
44
45Run **date +%Y--%m--%d**.
46
47
48## Output
49
50System date in the specified format:
51
52
53```
54OHOS:/$ date +%Y--%m--%d
551970--01--01
56```
57