@@ -4,73 +4,69 @@ Date and Time Manipulation
4
4
==========================
5
5
6
6
:term: `Datetime cycling <datetime cycling> ` suites inevitably involve
7
- performing some form of datetime arithmetic. In the
8
- :ref: `weather forecasting suite <tutorial-datetime-cycling-practical >` we wrote
9
- in the Cylc tutorial this arithmetic was done using the ``cylc cyclepoint ``
10
- command. For example we calculated the cycle point three hours before the
7
+ performing some form of datetime arithmetic. For example, in a Cylc task we
8
+ can calculate the cycle point three hours before the
11
9
present cycle using::
12
10
13
11
cylc cyclepoint --offset-hours=-3
14
12
15
- Rose provides the :ref: ` command-rose-date ` command which provides functionality
16
- beyond ``cylc cyclepoint `` as well as the :envvar: `ROSE_DATAC ` environment
13
+ The ` isodatetime `_ command provides functionality
14
+ beyond ``cylc cyclepoint ``. Rose also provides the :envvar: `ROSE_DATAC ` environment
17
15
variable which provides an easy way to get the path of the ``share/cycle ``
18
16
directory.
19
17
20
18
21
- The ``rose date `` Command
22
- -------------------------
19
+ The ``isodatetime `` Command
20
+ ---------------------------
23
21
24
- The :ref: ` command-rose-date ` command provides functionality for:
22
+ The `` isodatetime ` ` command provides functionality for:
25
23
26
24
* Parsing and formatting datetimes e.g:
27
25
28
26
.. code-block :: console
29
27
30
- $ rose date ' 12-31-2000' --parse-format='%m-%d-%Y'
28
+ $ isodatetime 12-31-2000 --parse-format='%m-%d-%Y'
31
29
12-31-2000
32
- $ rose date ' 12-31-2000' --parse-format='%m-%d-%Y' --format='DD-MM-CCYY'
30
+ $ isodatetime 12-31-2000 --parse-format='%m-%d-%Y' --format='DD-MM-CCYY'
33
31
31-12-2000
34
32
35
33
* Adding offsets to datetimes e.g:
36
34
37
35
.. code-block :: console
38
36
39
- $ rose date ' 2000-01-01T0000Z' --offset '+P1M'
40
- 2000-02-01T0000Z
37
+ $ isodatetime 2000-01-01T00:00Z --offset '+P1M'
38
+ 2000-02-01T00:00Z
41
39
42
40
* Calculating the duration between two datetimes e.g:
43
41
44
42
.. code-block :: console
45
43
46
- $ rose date ' 2000' ' 2001' # Note - 2000 was a leap year!
44
+ $ isodatetime 2000 2001 # Note - 2000 was a leap year!
47
45
P366D
48
46
49
- See the :ref: ` command-rose-date ` command reference for more information.
47
+ See the `` isodatetime --help ` ` command reference for more information.
50
48
51
49
52
- Using ``rose date `` In A Suite
53
- ------------------------------
50
+ Using ``isodatetime `` In A Suite
51
+ --------------------------------
54
52
55
- In datetime cycling suites :ref: ` command-rose-date ` can work with the
53
+ In datetime cycling suites, `` isodatetime ` ` can work with the
56
54
cyclepoint using the ``CYLC_TASK_CYCLE_POINT `` environment variable:
57
55
58
56
.. code-block :: cylc
59
57
60
58
[runtime]
61
59
[[hello_america]]
62
- script = rose date $CYLC_TASK_CYCLE_POINT --format='MM-DD-CCYY'
60
+ script = isodatetime $CYLC_TASK_CYCLE_POINT --format='MM-DD-CCYY'
63
61
64
- Alternatively, if you are providing the standard Rose task environment using
65
- :ref: `command-rose-task-env ` then :ref: `command-rose-date ` can use the ``-c ``
66
- option to pick up the cycle point:
62
+ Alternatively, Cylc automatically sets the ``ISODATETIMEREF `` environment variable
63
+ which allows you to use the special ``ref `` argument:
67
64
68
65
.. code-block :: cylc
69
66
70
67
[runtime]
71
68
[[hello_america]]
72
- env-script = eval $(rose task-env)
73
- script = rose date -c --format='MM-DD-CCYY'
69
+ script = isodatetime ref --format='MM-DD-CCYY'
74
70
75
71
76
72
The ``ROSE_DATAC `` Environment Variable
@@ -118,4 +114,4 @@ provide an offset to :ref:`command-rose-task-env` e.g::
118
114
119
115
The path is then made available as the ``ROSE_DATACPT1H `` environment variable.
120
116
121
- .. TODO - Write a short practical using ROSE_DATAC and rose-date .
117
+ .. TODO - Write a short practical using ROSE_DATAC and isodatetime .
0 commit comments