Format date time in server side to send eMail in correct timezone
Application Type
Reactive
Service Studio Version
11.14.14 (Build 59923)

Hello.

I need to send an email  and in that email's body there's a date in the format "dd/MM/yyyy hh:mm".

My problem is that I'm in serverside formatting the date and time and I know the server must be in UTC, so it will be formatted in UTC.

However the user receiving that email will be in a different timezone, and shoud see the date and time formatted for his timezone.

Reactive apps converts datetime automatically to the client's timezone, but on serverside I can't see an option to do that in a clean way.

There's a component called TimezoneReactiveUtils that has the action ConvertDateTimeByTimezoneOffset, but this action is client side only.

How to do this on serverside?

P.S. - I cannot relly on forge components for this project, so it has to be a standard feature.

Thank you for your help.

Hi Paulo,

On server side you can use below format function -

FormatDateTime(CurrDateTime(),"MMddYYYY")

Thanks

Vinod

Thank you for your reply, but it really doesn't answer my question.  I need to format in "dd/MM/yyyy hh:mm" specifying a timezone in serverside.

Hi Paulo,

You can use TimeZone forge component "ConvertFromTimeZone" action for that -

https://www.outsystems.com/forge/component-overview/500/time-zone



Thank you, but I need a standard solution for this. 

This project cannot relly on forge components.

mvp_badge
MVP

Hi Paulo,

That is, sorry for saying, a pretty dumb remark. Forge components are full citizens of the OutSystems ecosystem, and almost no project can live without them. Even things like OutSystems UI are part of the Forge!

Secondly, all Forge components can be downloaded and studied, so you can always check how a certain component does what it does, and copy that. But like I said, there's really no good reason at all not to use Forge components.

I'm sorry, but it's not a dumb remark, because I've no power over this decision of not using forge components that are not supported by Outsystems.

I see this may be the only good option to go and I'll check what I can do.

Thank you all.

mvp_badge
MVP

Yeah, I shouldn't have said "dumb remark", but more "dumb policy". The "not invented here" syndrome is, in general, not a very smart approach. Especially since (almost) all Forge components are open source, so you can literally take a look how it's done.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.