# Is there a year-to-date I can use for datetime?

**URL:** <https://forum.kx.com/t/is-there-a-year-to-date-i-can-use-for-datetime/14486>\
**Category:** Community Support\
**Tags:** dashboards\
**Created:** [July 15, 2025, 12:09pm UTC](https://forum.kx.com/t/is-there-a-year-to-date-i-can-use-for-datetime/14486 "2025-07-15T12:09:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Declan\_Fallon](https://sea2.discourse-cdn.com/flex002/user_avatar/forum.kx.com/declan_fallon/32/50_2.png) [@Declan\_Fallon](https://forum.kx.com/u/Declan_Fallon)\
**Post date:** [July 15, 2025, 12:09pm UTC](https://forum.kx.com/t/is-there-a-year-to-date-i-can-use-for-datetime/14486/1 "2025-07-15T12:09:46Z")

</div>

I have used NOW and permutations of if for datetime lookback periods, but is there one for YTD, other than hardcoding January 1st of the year?

Thanks

---

<div class="post-metadata">

**Author:** ![ppiatkovskyi](https://sea2.discourse-cdn.com/flex002/user_avatar/forum.kx.com/ppiatkovskyi/32/128_2.png) [@ppiatkovskyi](https://forum.kx.com/u/ppiatkovskyi)\
**Post date:** [July 15, 2025, 2:17pm UTC](https://forum.kx.com/t/is-there-a-year-to-date-i-can-use-for-datetime/14486/2 "2025-07-15T14:17:55Z")

</div>

The datetime corresponding to the start of the current year can be calculated e.g. as

```q
"z"$"d"$12 xbar"m"$.z.z

```
