Skip to content
English
  • There are no suggestions because the search field is empty.

Representing Dates and Times Within your Message Templates

Here we learn how to add datetime relative to another datetime so that your customer messaging is clear.

We are used to receiving generic messages that tell us “the show is 120 minutes long” but in crowdEngage we can change these messages so that it tells your customer the exact time they can expect to leave the theatre. For example “the show will end at 10.15pm”

You can also say things like “the bar will open at 6pm” instead of “the bar will open an hour before the show” 

 

A datetime is the name for a date and time combined.There are lots of built-in datetimes, but the one that is used most is below and represents the time that your instance starts (e.g the show start time - 7.45pm)

instance.start

 

We make sure these messages are accurate by relating everything to the show start time. If you wanted to tell your customers that the doors open 45 minutes before the show you could use the following code in crowdEngage


For a show that starts at 7.45pm on 1st May 2019  - this would output the message

2019-05-01 19:00

 

This date and time format is not the most user friendly but we can also change this so it reads a bit better.

 

We would amend this output using a code called strftime. 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:


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 letters (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 support@crowdengage.com if you'd like us to check over your template or give some feedback.