How can I format time output in Power Automate - 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

Related

Convert date format, BMC Remedy/smart-it

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.

How can i get current date for sequential file in DataStage?

Hello i'm having a problem with Datastage sequential file to get the date (current date) for sequential file.
the path i've been using is
#WMS_PATH.WMS_PATH#namefile_#DSJobStartDate#.csv
but i wanted the format to be YYYYMMDD, is there any way to do it?
These date functions are available
Date format options can be found here
Alternatively you could try DATE() and format that as needed.
Using the following function in a user variable stage then reference that user variable in the string path.
#uv stage code#
DateToString(DSJobStartDate, "%yyyy%mm%dd")
filepath
#WMS_PATH.WMS_PATH#namefile_#uvstage.datestring#.csv

In Freemarker Change output date format irrespective of input format

${(.vars["OCRResponse"].Date)?datetime("ANY RANDOM FORMAT")?string("mm-dd-yy").
Can we use If Else within ?datetime, or can we resolve this by using switch case?
If that date format is quite "random", and you need to do this a lot, then you are probably better of writing a freemarker.core.TemplateDateFormat+TemplateDateFormatFactory implementation, do the complex date parsing logic in Java, then register the factory as a "custom date format" (that's a FreeMarker configuration setting), let's say with name "random". Then you can do ${OCRResponse.Date?date.#random?string('MM-dd-yy')}. If you set the date_format configuration setting to MM-dd-yy, then you can even just write ${OCRResponse.Date?date.#random}.
You can find concrete examples of defining a custom formats here: https://freemarker.apache.org/docs/pgui_config_custom_formats.html
Another possibility is to use #if/#elseif/#else of course. If you need to do that on multiple places, then put your parser logic into a #function, where you #return the parsed date. So where you insert a date you just have something like ${parseRandom(OCRResponse.Date)} (here I have assumed that date_format is MM-dd-yy, otherwise add ?string('MM-dd-yy')).

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.

How I can format date in report to appear exactly as I want - RDLC

I have a report in my application and this report will show a long date from db and I used this expression to make it shorter:
=FormatDateTime(Fields!StatementDate.Value,DateFormat.ShortDate)
and the date will show like this : 1/1/2010
I need to make it like this : 2010/1/1
How I can do it?
That expression do the trick
=CDate(Fields!Fecha.Value).ToString("yyyy/M/d")
I think that it is a lot cleaner to use the Format property rather than format it in your expressions:
http://msdn.microsoft.com/en-us/library/ms252080%28v=vs.90%29.aspx
You can use the standard .NET formatting strings.
Value=Fields!StatementDate.Value
Format=yyyy/M/d
Fields!StatementDate.Value will need to be a DateTime, if not you can try convert it:
Value=CDate(Fields!StatementDate.Value)
=CDate(Fields!StatementDate.Value).ToShortDateString()

Resources