Following last week's post on text manipulation, I'll be sharing some tips today on how to manipulate dates, another common data type that you have to work with. Some use it to mark billing/subscription cycles, others need to record dates of certain key actions.
Whatever it is, understanding how to manipulate dates is an essential skill that you need to learn!
1. Date Plugins
First and foremost, do check out the plugin marketplace for date plugins - I have listed the 2 most popular free ones below, but feel free to explore all options to find the one you need.
These plugins allow your users to select dates/times, and at the same time, offer output that is customized to your needs.
2. Format Date as custom
Sometimes, you may need to format dates in a custom way, or in ISO time. You can use "formatted as" operator for dates to convert it into a custom format(see below).
If you prefer ISO8601 time, you can also use the following format below. Notice that double quotes were used to specify the additional characters 'T' and 'Z'.
yyyymmdd"T"HHMMss"Z"
Other than Amazon, I have not seen anyone else require this specific format. Usually, the 'T' and 'Z' characters are omitted.
3. Get 1st of the month
This is most often used for users who want to create billing cycles to charge their user or to reset user's monthly quota.
To get the 1st of the next month, simply do the following: (1) +1 month & (2) change date to 1
4. Get an arbitrary date/time
You can use the arbitrary date/time operator to get specific days/weeks of the month. Try the value below and see what happens!
Subscribe for more content like this!
If you have any questions, let me know via email or my Twitter.
Member discussion