Monday, June 26, 2023

Show datetime with reference to current time

 With(

    {

        x: First(

            Filter(

                Posts,

                PostID = ThisItem.PostID

            )

        ).Created

    },

    With(

        {

            y: Now()

        },

        If(

            DateDiff(

                x,

                y,

                TimeUnit.Seconds

            ) < 60,

            DateDiff(

                x,

                y,

                TimeUnit.Seconds

            ) & " secs",

            If(

                DateDiff(

                    x,

                    y,

                    TimeUnit.Minutes

                ) < 60,

                DateDiff(

                    x,

                    y,

                    TimeUnit.Minutes

                ) & " min(s)",

                If(

                    DateDiff(

                        x,

                        y,

                        TimeUnit.Hours

                    ) < 24,

                    DateDiff(

                        x,

                        y,

                        TimeUnit.Hours

                    ) & " hour(s)",

                    If(

                        DateDiff(

                            x,

                            y,

                            TimeUnit.Days

                        ) < 365,

                        DateDiff(

                            x,

                            y,

                            TimeUnit.Days

                        ) & " days(s)",

                        x

                    )

                )

            )

        )

    )

)

No comments:

Post a Comment

Add Service Principle support in Custom Connector

  then search for "Streamlining Integration: Using Service Principal authentication on Custom connectors with Microsoft Graph Applicati...