Convert date format, BMC Remedy/smart-it - converters

Problem:
In a field called $Detailed Decription$ sometimes dateformat 08/09/2021 is enterd and this need to be converted to swedish format 2022-02-11
I'am going to use BMC Developer studio and make a filter but i cant find a fitting solution for it. Replacing it wont work (i think) becaus it need to have a value to replace it with.
Maby there can be a function that reads regex (\d{2})/(\d{1,2})/(\d{4}) but how can i convert it?

If it's sometimes - look at AR System User Preferencje form. Check certain user's locale and date time config.
Also is important where the data comes from. Could be a browser setting or java script mod.

1- Using Set fields action, copy the date value from Detailed Description to a Date/Time field (i.e. z1D_DateTime01).
2- Using Set fields action and Functions (MONTH, YEAR, DAY, HOUR, MINUTE, SECOND) you can parse the date/time and convert it to format you like.
Something like this:
SwedishDate = YEAR($z1D_DateTime01$) + "-" + MONTH($z1D_DateTime01$) + "-" + DAY($z1D_DateTime01$)
This will capture the parts of date and combine them with "-" in the middle and in the order you want.

Related

How can I format time output in Power Automate

In my power automate flow, I have an action that give time output in this format: 2022-12-01T18:52:50.0000000Z
How can I take this output and format as yyyy/mm/dd .
I want to use the time output as string for a folder structure.
https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#formatDateTime
Assuming you have a variable called DateTime, you would create another variable and use this expression ...
formatDateTime(Variables('DateTime'), 'yyyy/MM/dd')
Result
This is pretty straight forward.
Use the Convert datetime to text function
In the Format to use dropdown select Custom
and specify the format how you would like it to appear.
yyyy/MM/hh will give you 2022/12/01
HH-mm-ss will give you 18-52-50

ZEN : Allow multiple date formats in a dateText control and converting them to the YYYY-MM-DD

There is a finite list of date formats that users want to use to enter a date in a form. These formats include single digits for month and day and double digits for year. The field is represented by a dateText control.
How would one get to allow a dateText control to accept multiple date formats ? I see only 3 listed (https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=GZCP_forms_dateText), do those include using single digits for month and day ?
I tried to set the value of format = "#(myPageProperty.myValue)# " but I got a compilation error in Studio so that went nowhere. Has anyone ever been able to set the format value depending on the user input value?
I am guessing that the control input value must be converted to the YYYY-MM-DD before validation. I am open to calling a javascript function to do that but where would be the best place to put it?
for details see Class %ZEN.Component.dateText
setting format:
Property format As %ZEN.Datatype.string(MAXLEN = 3, **VALUELIST = ",MDY,DMY,YMD",** ZENEXPRESSION = 1)
you have exactly 3 formats or ""
Your guess on values is correct and documented:
/// The value of this control is always in the canonical form: YYYY-MM-DD
As this is one of the oldest components of ZEN your only chance to achieve
your way of operation is to create your own version inheriting from
Class %ZEN.Component.dateText and overloading the parts you want to change

Formatting date to a particular type in zapier cli

In my inputFields of zapier, there's one field where the user can enter the date but I want the zapier to work only if I write the date in "2020-09-18T15:30" otherwise it should show a message that the data entered does not match the format specified. I tried this but it's not working.
const activityEditableFields = async (z, bundle) => {
if (bundle.inputData.dueDate) {
(/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}Z/.test(`${bundle.inputData.dueDate}`))
}
here duedate in the field and I am giving the format that if there is data in it then it should match the specified format but there's no difference in the zap. If you can help me as soon as possible. Do reply.
This shouldn't be necessary. Per the docs:
DateTime fields let users enter dates and times, using their human readable values, machine readable datetimes, or standard English words for time like tomorrow. Zapier interperpates the date input from users and outputs a standard ISO 8601 datetime to your API.
If you declare the field as a datetime, then bundle.inputData.dueDate will always be a proper ISO 8601 datetime.
The easiest way I could find to workaround this issue was to use with JS code only the first 10 characters of the ISO8601 Zapier date.
bundle.inputData.dueDate.substr(0,10)
or to use moment to parse date (This library is supported by Zapier):
const moment = z.require('moment');
....
moment(bundle.inputData.dueDate).format("YYYY-MM-DD HH:MM:SS UTC")
The only drawback is that you need to use the code editor

How to format CRM "Date Only" field to string with Freemarker?

Im trying to build a email template with Freemarker/Clickdimensions plugin in CRM 2013. I have a "Date only" field on an entity which for example contains the date 2017-04-17. I want this date to show as the following: Monday 17 april.
This is done with Freemarker and I have tried the following:
<#assign x = Recipient.field_booking.field_scheduleddate?time>
${x?string.full}
This doesnt seem to work. Im not getting any result at all, just an empty line.
Does anyone know what could be wrong?
I will assume that field_scheduleddate is a string (not a java.util.Date).
At ?time FreeMarker should throw and exception saying something like that the string doesn't follow the expected pattern. I suspect the framework you are using catches and suppresses that exception (which makes using FreeMarker much much harder). Check the logs, maybe it's there.
You want to deal with a date-only value there, hence you should use ?date, as ?time is for time-only values. Also, field_scheduleddate apparently uses ISO 8601 format, so unless the date_format configuration setting is set to ISO, you will have to use ?date.iso (supported since FreeMarker 2.3.21).
As of printing the date, ?string.full should work, but usually you should set date_format globally to the format you prefer, and then you can simply write ${x}.
(Also note that #assign is unnecessary above, as you can put arbitrarily complex expression inside ${}.)

Changing the timezone strings of date_lang.php

CodeIgniter stores timezones for its date class in
system/language/english/date_lang.php
I would like to change the strings in this file so that
$lang['UM12'] = '(UTC -12:00) Baker/Howland Island';
$lang['UM11'] = '(UTC -11:00) Samoa Time Zone, Niue';
would instead be
$lang['-12:00'] = '(UTC -12:00) Baker/Howland Island';
$lang['-11:00'] = '(UTC -11:00) Samoa Time Zone, Niue';
Is this possible at all?
Any change I make to the UM__ portion of one line makes it show as a blank on the dropdown. The remaining (unchanged) lines appear OK.
I have also tried to clone this file to application/language/english/ with similar bad results.
Any insights on this?
It looks like this would require hacks to the date_helper.php file which I am not willing to do.
Instead, the date class in CI has the timezones() function which allows you to convert from, for example, UM5 to -5. In that case one can wrap this function around the U__ value coming from the view/dropdown -- and then save it to DB as -5 or some other INT.
Since I want to show the user their selected timezone on that same dropdown, I am forced to have DB fields for the U__ and INT timezone formats. As far as I know, there is no CI function to convert from -5 to UM5.
So, for the user, I pull the U__ format into the view to autopopulate the dropdown.
For timezone conversions and such, I use the INT format.

Resources