> For the complete documentation index, see [llms.txt](https://docs.criticalmoments.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.criticalmoments.io/conditional-targeting/conditional-guides/working-with-dates.md).

# Working with Dates

Critical Moments provides a set of helper functions to make working with conditions strings with dates easy! Well, at least as easy as working with dates can be...

## Date Functions

* [Now function](/conditional-targeting/syntax-and-operators.md#now)
* [Parse date function](/conditional-targeting/syntax-and-operators.md#date-str-format-timezone)
* [Duration function](/conditional-targeting/syntax-and-operators.md#duration-str)
* [Format date function](/conditional-targeting/syntax-and-operators.md#formattime-timestamp-format-timezone)
* [Unix time functions](/conditional-targeting/syntax-and-operators.md#unixtimeseconds-int-unixtimemilliseconds-int-unixtimenanoseconds-int-functions)

## Example Conditions With Dates

* Did the user downloaded this app in the last 12 hours?
  * `app_install_date > now() - duration('12h')`
* Did the user install the app more than 30 days ago?
  * `app_install_date < now() - duration('720h')`
* Did the user downloaded the app before a given absolute datetime?
  * `app_install_date > date('2023-01-25T12:00:00+00:00')`
* Is the current device time after a date, in the user's local timezone? For example: launching new feature at midnight local time.
  * `now() > date('2024-04-05', date_format, 'Local')`
* Is the time between 10pm PST and 11pm PST on a given date? Example: you're taking your service down for maintenance and what to show a "we'll be back online soon" message:
  * `now() > date('2024-01-15T22:00:00-08:00') && now() < date('2024-01-15T23:00:00-08:00')`&#x20;
* Was the app was installed before a given unix timestamp?
  * `app_install_date < unixTimeMilliseconds(1136189045000)`
* Is it currently a Wednesday in the user's local timezone
  * `formatTime(now(), 'dow') == 3` or `formatTime(now(), 'dow_long') == 'Wednesday'`
* Is it currently the evening (5pm-9pm) in the user's local timzeone
  * `formatTime(now(), 'hod') >= 17 || formatTime(now(), 'hod') <= 21`&#x20;
