We're all used to messages that say "doors open 45 minutes before the show" or "the show is 120 minutes". With crowdEngage you can turn those into an actual time - for example, "doors open at 6.15pm", or "the show will finish at 9pm".
A datetime is the name for a date and time combined. For example, 1:15pm on the 1st May 2019 is represented like this:
2019-05-01T13:15:00.000
There are lots of built-in datetimes, but the one that is used most is:
instance.start
which is the date and time the instance (or performance) starts.
Let's say you want to tell people that doors open 45 minutes before the show starts. Here's how you do it in crowdEngage:
{{ relative_datetime(instance.start, minutes=-45) }}
which, for a show that would start 7.45pm on the 1st May 2019, would output:
2019-05-01 19:00
Not very friendly! But we can use strftime to format the datetime in the way we want. You can find more about how to use strftime here, but the rough gist is that each part of a datetime (e.g. the day, the hour, the minute) is represented by a code. This means you can format the datetime in the exact way you want. For example:
{{ relative_datetime(instance.start, minutes=-45).strftime('%-I:%M%p')|lower }}
The %-I means the hour, followed by a colon and then %M which is the minutes. %p is AM or PM. Then we pipe (|) the whole thing into lower, which converts it to lowercase (just because AM and PM can look a bit shouty in caps). That would give us:
7:00pm
Strftime can be a little bit daunting at first, so feel free to get in touch with crowdEngage support if you'd like us to check over your template or give some advice.