# Support for truncated ISO-8601 datetimes?

**URL:** <https://cylc.discourse.group/t/support-for-truncated-iso-8601-datetimes/755>\
**Category:** Cylc Development\
**Created:** [September 12, 2023, 5:36am UTC](https://cylc.discourse.group/t/support-for-truncated-iso-8601-datetimes/755 "2023-09-12T05:36:25Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonnyhtw](https://yyz2.discourse-cdn.com/free1/user_avatar/cylc.discourse.group/jonnyhtw/32/232_2.png) [@jonnyhtw](https://cylc.discourse.group/u/jonnyhtw)\
**Post date:** [September 12, 2023, 5:36am UTC](https://cylc.discourse.group/t/support-for-truncated-iso-8601-datetimes/755/1 "2023-09-12T05:36:25Z")

</div>

hey,

pretty much all my workflows (presumably same as most weather and climate users) have cycle points of the form…

`19990101T0000Z`

for climate workflows, the cycle points almost always fall at midnight on the 1st of the month, i.e. `...01T0000Z`.

just wondering how possible it would be to make `cylc` interpret truncated datetimes? so for example…

`199901 <---> 19990101T0000Z`

or even…

`1999 <---> 19990101T0000Z`

just wondering!

cheers,

jonny

---

<div class="post-metadata">

**Author:** ![wxtim](https://yyz2.discourse-cdn.com/free1/user_avatar/cylc.discourse.group/wxtim/32/151_2.png) [@wxtim](https://cylc.discourse.group/u/wxtim)\
**Post date:** [September 12, 2023, 6:52am UTC](https://cylc.discourse.group/t/support-for-truncated-iso-8601-datetimes/755/2 "2023-09-12T06:52:58Z")

</div>

> cycle points almost always fall at midnight on the 1st of the month

If it’s almost you might find it tricky. If it’s actually _always_ you can set [`flow.cylc[scheduler]cycle point format`](https://cylc.github.io/cylc-doc/stable/html/reference/config/workflow.html#flow.cylc%5Bscheduler%5Dcycle%20point%20format). I think that in your case `CCYYMM` will achieve what you want.

If you can’t use this, can you give me more context about where you’d want to use the truncated format?

---

<div class="post-metadata">

**Author:** ![oliver.sanders](https://yyz2.discourse-cdn.com/free1/user_avatar/cylc.discourse.group/oliver.sanders/32/110_2.png) [@oliver.sanders](https://cylc.discourse.group/u/oliver.sanders)\
**Post date:** [September 12, 2023, 9:04am UTC](https://cylc.discourse.group/t/support-for-truncated-iso-8601-datetimes/755/3 "2023-09-12T09:04:39Z")

</div>

> [@Tip: Cycle Point Format](https://cylc.discourse.group/t/tip-cycle-point-format/685):
>
> Cylc uses the [ISO8601](https://cylc.github.io/cylc-doc/stable/html/tutorial/scheduling/datetime-cycling.html#iso8601) time point syntax for cycle points. For example, this workflow: [scheduling] initial cycle point = 2020 [[graph]] P1Y = @wall\_clock =\> happy-new-year [runtime] [[happy-new-year]] script = echo "Happy ${CYLC\_TASK\_CYCLE\_POINT}!" Will produce cycle points like this: 20200101T0000Z 20210101T0000Z 20220101T0000Z … These cycle points are used to form task IDs and are passed into tasks using the $CYLC\_TASK\_CYCLE\_POINT environment variable: $ cy…

---

<div class="post-metadata">

**Author:** ![MetRonnie](https://yyz2.discourse-cdn.com/free1/user_avatar/cylc.discourse.group/metronnie/32/125_2.png) [@MetRonnie](https://cylc.discourse.group/u/MetRonnie)\
**Post date:** [September 12, 2023, 11:23am UTC](https://cylc.discourse.group/t/support-for-truncated-iso-8601-datetimes/755/4 "2023-09-12T11:23:43Z")

</div>

Is there a specific case where using a truncated datetime is not working for you? In general, Cylc does indeed support truncated datetimes.

---

<div class="post-metadata">

**Author:** ![oliver.sanders](https://yyz2.discourse-cdn.com/free1/user_avatar/cylc.discourse.group/oliver.sanders/32/110_2.png) [@oliver.sanders](https://cylc.discourse.group/u/oliver.sanders)\
**Post date:** [September 12, 2023, 12:30pm UTC](https://cylc.discourse.group/t/support-for-truncated-iso-8601-datetimes/755/5 "2023-09-12T12:30:54Z")

</div>

Jonny’s referring to reduced precision datetimes (i.e. truncated from the right) rather than what Cylc refers to as truncated datetimes (i.e. truncated from the left).

The `[scheduler]cycling point format` is the way to go for this case.

---

<div class="post-metadata">

**Author:** ![MetRonnie](https://yyz2.discourse-cdn.com/free1/user_avatar/cylc.discourse.group/metronnie/32/125_2.png) [@MetRonnie](https://cylc.discourse.group/u/MetRonnie)\
**Post date:** [September 12, 2023, 1:29pm UTC](https://cylc.discourse.group/t/support-for-truncated-iso-8601-datetimes/755/6 "2023-09-12T13:29:18Z")

</div>

Ok yes, we should be clear about the terminology. But regardless, Cylc interprets `2000` as `20000101T0000Z` in most circumstances without having to set the cycle point format. Setting the cycle point format has the additional effect of printing all cycle points in that format and means you cannot use precision greater than the smallest unit in the format

---

<div class="post-metadata">

**Author:** ![jonnyhtw](https://yyz2.discourse-cdn.com/free1/user_avatar/cylc.discourse.group/jonnyhtw/32/232_2.png) [@jonnyhtw](https://cylc.discourse.group/u/jonnyhtw)\
**Post date:** [September 13, 2023, 2:15am UTC](https://cylc.discourse.group/t/support-for-truncated-iso-8601-datetimes/755/7 "2023-09-13T02:15:02Z")

</div>

thanks a lot for all the information @MetRonnie & @oliver.sanders!

the application that i’d be interested in setting up and/or finding out more about is using the command line `cylc` tools. i probably should’ve said that in my original post! 😛 e.g. at the moment i use commands like this a lot (already using the assumed `runN` shorthand before the `//`)…

```auto
cylc log u-cy821//19780101T0000Z/fcm_make_lfric

```

and it would be handy to be able to type…

```auto
cylc log u-cy821//197809/fcm_make_lfric

```

… for example.

i think i probably don’t want to start messing around with the format of the dates in the workflows themselves since my work is so highly collaborative and i don’t want to make unilateral decisions for other users.

basically i was wondering if there is a way of making the `cylc` command line arguments assume that something happens at `01T000Z` or even `0101T0000Z` _unless_ told otherwise!

hope that makes sense!

cheers,

j

---

<div class="post-metadata">

**Author:** ![dpmatthews](https://yyz2.discourse-cdn.com/free1/user_avatar/cylc.discourse.group/dpmatthews/32/26_2.png) [@dpmatthews](https://cylc.discourse.group/u/dpmatthews)\
**Post date:** [September 13, 2023, 7:04am UTC](https://cylc.discourse.group/t/support-for-truncated-iso-8601-datetimes/755/8 "2023-09-13T07:04:15Z")

</div>

> [@jonnyhtw](#):
>
> i was wondering if there is a way of making the `cylc` command line arguments assume that something happens at `01T000Z` or even `0101T0000Z` _unless_ told otherwise!

That’s not possible. However, you can use bash auto completion: [https://cylc.github.io/cylc-doc/8.2.1/html/reference/changes.html#bash-completion](https://cylc.github.io/cylc-doc/8.2.1/html/reference/changes.html#bash-completion)

---

<div class="post-metadata">

**Author:** ![MetRonnie](https://yyz2.discourse-cdn.com/free1/user_avatar/cylc.discourse.group/metronnie/32/125_2.png) [@MetRonnie](https://cylc.discourse.group/u/MetRonnie)\
**Post date:** [September 13, 2023, 9:15am UTC](https://cylc.discourse.group/t/support-for-truncated-iso-8601-datetimes/755/9 "2023-09-13T09:15:38Z")

</div>

> [@jonnyhtw](#):
>
> it would be handy to be able to type…
> 
> ```auto
> cylc log u-cy821//197809/fcm_make_lfric
> 
> ```

Ah unfortunately `cylc log` (aka `cylc cat-log`) is a special case - the cycle point in the ID you type has to match the job log file path (but as Dave mentioned, it can be autocompleted).

But commands like `cylc hold`, `cylc trigger` etc. accept partially specified cycles e.g.

```auto
cylc hold u-cy821//1978-09/fcm_make_lfric

```

(note you have to use the dash between the year and month)

---

<div class="post-metadata">

**Author:** ![jonnyhtw](https://yyz2.discourse-cdn.com/free1/user_avatar/cylc.discourse.group/jonnyhtw/32/232_2.png) [@jonnyhtw](https://cylc.discourse.group/u/jonnyhtw)\
**Post date:** [September 14, 2023, 3:14am UTC](https://cylc.discourse.group/t/support-for-truncated-iso-8601-datetimes/755/10 "2023-09-14T03:14:00Z")

</div>

oh cool, didn’t know this!

it’s not working for me out of the box for some reason though 🤔

i’ll look into it, thanks @dpmatthews

---

<div class="post-metadata">

**Author:** ![jonnyhtw](https://yyz2.discourse-cdn.com/free1/user_avatar/cylc.discourse.group/jonnyhtw/32/232_2.png) [@jonnyhtw](https://cylc.discourse.group/u/jonnyhtw)\
**Post date:** [September 14, 2023, 3:22am UTC](https://cylc.discourse.group/t/support-for-truncated-iso-8601-datetimes/755/11 "2023-09-14T03:22:18Z")

</div>

thanks @MetRonnie,

good to know! playing around with this, i’ve found that this works (as you mentioned)…

`cylc tr u-cy821/runN//1978-09/install_ainitial`

and this one too…

` cylc tr u-cy821/runN//19780901/install_ainitial`

but this one doesn’t…

`cylc tr u-cy821/runN//197809/install_ainitial`

why does my first example above need a dash between `1978` and `09`?

---

<div class="post-metadata">

**Author:** ![jonnyhtw](https://yyz2.discourse-cdn.com/free1/user_avatar/cylc.discourse.group/jonnyhtw/32/232_2.png) [@jonnyhtw](https://cylc.discourse.group/u/jonnyhtw)\
**Post date:** [September 14, 2023, 3:45am UTC](https://cylc.discourse.group/t/support-for-truncated-iso-8601-datetimes/755/12 "2023-09-14T03:45:41Z")

</div>

working now! thanks to @hilary.j.oliver!

for future ref…

`cylc get-resources cylc-completion.bash <path-to-copy-file>`

then put this in your `.bashrc` or equivalent…

```auto
if [[$- =~ i && -f /path/to/cylc-completion.bash]]; then
    . /path/to/cylc-completion.bash
fi

```

🙂

---

<div class="post-metadata">

**Author:** ![MetRonnie](https://yyz2.discourse-cdn.com/free1/user_avatar/cylc.discourse.group/metronnie/32/125_2.png) [@MetRonnie](https://cylc.discourse.group/u/MetRonnie)\
**Post date:** [September 14, 2023, 9:17am UTC](https://cylc.discourse.group/t/support-for-truncated-iso-8601-datetimes/755/13 "2023-09-14T09:17:26Z")

</div>

> [@jonnyhtw](#):
>
> why does my first example above need a dash between `1978` and `09`?

I think it’s because that’s interpreted as the year 197809 rather than September 1978

---

<div class="post-metadata">

**Author:** ![jonnyhtw](https://yyz2.discourse-cdn.com/free1/user_avatar/cylc.discourse.group/jonnyhtw/32/232_2.png) [@jonnyhtw](https://cylc.discourse.group/u/jonnyhtw)\
**Post date:** [September 14, 2023, 11:38pm UTC](https://cylc.discourse.group/t/support-for-truncated-iso-8601-datetimes/755/14 "2023-09-14T23:38:55Z")

</div>

ah ok, makes sense, even if that is something of a sci-fi date! 🙂
