If condition with the Azure Pipe - expression

I want to add Mon - Friday within this expression. Can someone help me..
#And(GreaterOrEquals(utcnow(),convertTimeZone('07:00:00','Eastern Standard Time','UTC')),LessOrEquals(utcnow(),convertTimeZone('15:00:00','Eastern Standard Time','UTC')))

Related

in Power Automate, how can I convert long-format datetime strings?

In a Power Automate / MSFlow flow, I receive a string like this:
Saturday, July 31, 2021 1:35 AM  |  (UTC+01:00) Dublin, Edinburgh, Lisbon, London
I need to convert it to the format Sharepoint expects, i.e. a ISO 8601 for UTC:
YYYY-MM-DDTHH:MM:SS
I painfully built a flow that does most of the work; however, at the thought of having to manually manage the timezone offset my heart finally gave out. It's shocking that in 2021 a product like this cannot parse a datetime like we could do in any language in 1995.
So my question is: what's the easiest way to parse this datetime correctly in PA/Flow...?
I followed the MS reference:
Workflow definition language functions reference: formatDateTime
And the way to go was with "formatDateTime" function:
formatDateTime('<timestamp>', '<format>'?)
But, before that, the timestamp should be reformated in your case.
My approach will be the following:
Let's assume that the input string will be stored in a variable named timestamp_original.
Take the part before "|" character from the timestamp_original. and remove the Day (at the beginning) from the result.
pass the result to the formatDateTime function.
Use the convertTimeZone function to achieve the TimeZone conversion. (but this part is not working as I expected).
So the final result should be obtained by using the next expressions:
convertTimeZone(formatDateTime(first( split( substring(variables('timestamp_original'), add(2, indexOf(variables('timestamp_original'),','))) , '|' ) )), 'Central Europe Standard Time', 'Greenwich Standard Time')
The solution to the point 3, should be extracting the TimeZone from the timestamp_original string:
trim(first(split(last( split(variables('timestamp_original'), '(' ) ), ')')))
And add some logic to test if this TimeZone contains "UTC+" or "UTC-" and add or extract hours from the obtained timestamp.
I think you can do this.
It should be noted that the variable 'timestamp_original' should be initially in the next format (as the OP mentionned):
Saturday, July 31, 2021 1:35 AM | (UTC+01:00) Dublin, Edinburgh, Lisbon, London
So the result will be: (using the convertTimeZone function)
2021-07-30T23:35:00.0000000
And without using the convertTimeZone function:
2021-07-31T01:35:00.0000000
I hope this has helped. Good luck.

Kendo DateTimePicker, after parsing the Date the Year is Incorrect

Good Afternoon Fellow Code Monkey's
I'm new to StackOverflow, and Kendo UI programming. My problem is as follows. When trying to parse the date, and everything seems to work correctly until I get to the year portion.
here is my Javascript Code
$('#datepicker').kendoDatePicker({
format: 'MM dd yyyy',
parseFormats:['M/d/yy', 'MM/d/yy', 'MM/dd/yy', 'M/dd/yy', 'M/d/yyyy', 'MM/d/yyyy', 'MM/dd/yyyy','M/dd/yyyy','Mdyy','MMdyy', 'MMddyy', 'Mdyyyy', 'Mddyyyy', 'MMddyyyy', 'M-d-yy', 'MM-d-yy', 'MM-dd-yy', 'M-dd-yy', 'M-d-yyyy', 'MM-d-yyyy', 'MM-dd-yyyy', 'M-dd-yyyy']
});
Basically I want the user to be able to type the date into the Datepicker in any format, from 05052012 to 5/5/2012, etc and then the box formats. The above code for instance when entering "05052012" returns in the box 05 05 2020. Is there something wrong with how I have the year set up?
Thanks in advance,
SithApprentice
I think I have it figured out, seems sort of silly now. Apparently it has to do with the order in which I'm passing the formats with which I will be paresing. those with yy must come at the end, and those with yyyy must come at the beginning. I really wishTelerik mentioned this in their API Reference section for the date picker. From theier examples they make it seem like the order does not matter.

How do I simulate an SQL `timestamp` in plain old Ruby?

I am enforcing the output of a datetime as Zulu-Time by doing the following
object.updated_at.utc.iso8601 # => "2013-05-12T10:47:01Z"
This works fine for a datetime but when the object is persisting to a database as a timestamp instead I get
"Sun, 12 May 2013 10:47:01 UTC +00:00"
Which is not a Zulu Time string.
I can fix this by
object.updated_at.to_time.utc.iso8601
but I am now trying to unit test this fix, and I can't reproduce the timestamp format to test it.
How do I simulate an SQL timestamp such that .utc.iso8601 returns "Sun, 12 May 2013 10:47:01 UTC +00:00", but without wrapping it in a whole mess of ActiveRecord etc?
Turned out my problem was me not wearing my glasses and misreading my own test code. I'd close the question except there is no 'closing the question because I forgot my glasses' option.

Validate dates before 1970-01-01

How can I validate date before 1970-01-01 (like 1900-01-01)?
When I try to use CDateVaildator it ends with CTimestamp::getTimestamp() (I found it with help of debugger)
return #mktime($hr,$min,$sec,$mon,$day,$year)
where $hr=0, $min=0, $sec=0, $mon=1, $dat=1, $year=1900 which obviously returns false and this fails whole validation.
CTimestamp::getTimestamp() will generate a timestamp for any dates from 1901 (not 1900!) up to 2038. For dates between 1901 and 1970 it generates a negative number. Just tested it, and the earliest date I can get to work is 14th December 1901. Anything before this throws an error. Not sure how to deal with dates outside this range!
In Yii there is an error described here. The solution is presented there but for some reason it's not included in Yii 1.1.14 although it's marked as committed to trunk.
To make long story short - the fix tries to build timestamp only when there is a property in rules defined.
To use it in own project you have to extend CDateValidator and CDateTimeParser.

Is there a way to easily parse the year from the [site.time] property in Jekyll?

Is there a way to just pull the year (or any other element... month, day, etc) from the site.time property that is available to your template file in Jekyll?
Right now it returns, for example: Sat Dec 19 14:07:03 -0700 2009
Any help is appreciated. Thanks!
The site.time item is available for templating using Liquid, so I think that you want something like this:
<h2>last modified: {{site.time | date: "%Y%m%d"}}</h2>
See here for more on Liquid: Liquid for Designers.

Resources