Jump to content
chrisnutt

Utilities date formatter time zone issue

Recommended Posts

Hi,

I am trying to include the scheduled start time of a change in an email template. I can't find this in the list of available variables so have updated my business process to take the scheduled start time from a get request details, use the date formatter utility to convert it to how I want it to display and then put that in a custom field which I will use in the template. I am using a TEXT custom field as all the VARCHAR ones are in use. I am, however, getting the wrong time in the email. It is showing one hour earlier than it should, after I added timezone to check if that was the issue this is what I see:

08-06-2020 08:00 GMT Daylight Time

For the avoidance of doubt, the scheduled start time is 0900, not 0800.

I really do not want to mess with the time zone settings as I have read in another post that BST applies automatically, but you just leave it as GMT. Why is this time incorrect? How can I correct it without messing with system timezone settings?

Thanks

Chris

Share this post


Link to post
Share on other sites

Hi @chrisnutt 

You are able to get the start and end dates and proposed dates as variables in the email templates.

In the admin console, on the template view, chance the type to Changerequests  rather than the default requests (as shown below)

image.png

When you create an email template against the change request, you will have all the request variables plus the change variables including the required date variables.

image.png

When sending the email from your business process, ensure you populate the Email Template Entity field with ChangeRequest

image.png

 

Share this post


Link to post
Share on other sites

Thanks @Steven Boardman, that's great. I didn't know that!

How do I format that though? I need it to be day-month-year hour:minute. But that isn't the format of it in that field.

Thanks

Chris

Share this post


Link to post
Share on other sites

@chrisnutt what format are you seeing?

In my request i am seeing the following

Start and end dates and proposed dates in the details section

image.png

Using the date / time format from my profile

image.png

 

Then in an email template this is respected.

 

image.png

Share this post


Link to post
Share on other sites

Ah, I see. To be fair, I hadn't tried in an email itself. Was just looking at the value in the DB.

Very useful help. I will do as you suggest!

Thanks

Share this post


Link to post
Share on other sites

Hi Chris,

Regarding the date format in the email template. We have added an email template modifier called formatLocalTime to support formatting of dateTime columns/variables using system defined regional settings. This system modifier uses these system settings system.regionalSettings.timezone and system.regionalSettings.dateTimeFormat for formatting.

Example:

Non-formatted
DateTime value from DB (UTC): {{.h_created}}

Formatted
Formatted DateTime based on System Regional Settings: {{.h_created|formatLocalTime}}
 

I"m not completely sure this will resolve your formatting, but worth having a look at.  The key here is that the field that holds your date has to be a dateTime field.  

Regards,

James

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...