cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Brendan1
Helper I
Helper I

sequencing 24 hour time for a dropdown

Hi Fellow Makers!

 

I am trying to sequence set of values to represent 24 hour time in 15 minute increments.  Here is my current approach:

 

ForAll(
    Sequence(
        96,
        0,
        0.25
    ),
    Concatenate(
        First(
            Split(
                Text(Value),".")
                ),
                ":",
                Switch(
                    Last(Split(Text(Value),".")),
                    "25","15",
                    "50","30",
                    "75","45",
                    ""
                    )
                    )
)

 

Problem 1: the concatenate function does not like my First() statement.

Possible Problem 2: I am not sure if I can use a Switch() inside a concatenate function.  

 

 

Can anyone point me in the right direction?

 

 

Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Brendan1 :

Please try:

ForAll(
    Sequence(96,0,0.25),
    Text(RoundDown(Value,0),"00")&":"&Text(Mod(Value*60,60),"00")
)

Best Regards,

Bof

View solution in original post

3 REPLIES 3
Brendan1
Helper I
Helper I

After a bit more tinkering, I got to this code which gives me "almost" the desired result:

 

 

ForAll(
    Sequence(
        96,
        0,
        0.25
    ),
    Concatenate(
        Text(
            First(
                Split(
                    Text(ThisRecord.Value),
                    "."
                )
            ).Result,
            "[$-en-US]00"
        ),
        ":",
        Switch(
            Last(
                Split(
                    Text(ThisRecord.Value),
                    "."
                )
            ).Result,
            "25",
            "15",
            "50",
            "30",
            "75",
            "45",
            "00"
        )
    )
)

 

One thing I can't make it do though, is display the single digit hour value as double digits  i.e. 1:00AM shows as "1:00" instead of "01:00".  I thought this was what the "[$-en-US]00" text format string would achieve, but it doesn't seem to work.

 

If anyone has an idea on how I could modify this to change to double digit hours, I would really appreciate it.

 

 

Thanks.

Hi @Brendan1 :

Please try:

ForAll(
    Sequence(96,0,0.25),
    Text(RoundDown(Value,0),"00")&":"&Text(Mod(Value*60,60),"00")
)

Best Regards,

Bof

Brendan1
Helper I
Helper I

Works perfectly @v-bofeng-msft !  Thanks for your help.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (5,090)