cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Cooper01
Level 8

Get weekday from number 0-6?

I'd like to convert a weekday stored as a number 0-6 as text value of a weekday. I thought I'd be able to use the text function to convert like this:

Text(0, "dddd")

to get value Sunday. Instead, regardless of what I have as the first parameter, the value returned (I'm using a label) is Wednesday. Is there any other way to make this conversion besides an If statement? (If(weekday = 0, "Sunday, If(weekday = 1, "Monday", ...)

1 ACCEPTED SOLUTION

Accepted Solutions
EricLott
Level 10

Re: Get weekday from number 0-6?

@Cooper01 

You can use this formula

 

Set(YourNumber0Through6, 0);
Text(DateAdd(DateValue("1/1/2017"),YourNumber0Through6,Days),"dddd")

 

I only used '1/1/17' because it is a Sunday. You can use any Sunday.

This also works, if it feels cleaner to you. Just replace the 0 with your value.

Text(DateAdd(DateValue("7"),0,Days),"[$-en-US]dddd")

---
If this answered your question, please click "Accept Solution". If this helped, please Thumbs Up.

View solution in original post

3 REPLIES 3
Super User
Super User

Re: Get weekday from number 0-6?

You can try Switch, here us a link to some info about Switch:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-if

If you have already tried this and are looking for other potential solutions, let me know.

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

Thanks!
Hardit Bhatia
The Power Addict
https://thepoweraddict.com
Cooper01
Level 8

Re: Get weekday from number 0-6?

Thanks. I am aware of Switch too, I just wanted to make sure there wasn't a cleaner or built in way to make the conversion

EricLott
Level 10

Re: Get weekday from number 0-6?

@Cooper01 

You can use this formula

 

Set(YourNumber0Through6, 0);
Text(DateAdd(DateValue("1/1/2017"),YourNumber0Through6,Days),"dddd")

 

I only used '1/1/17' because it is a Sunday. You can use any Sunday.

This also works, if it feels cleaner to you. Just replace the 0 with your value.

Text(DateAdd(DateValue("7"),0,Days),"[$-en-US]dddd")

---
If this answered your question, please click "Accept Solution". If this helped, please Thumbs Up.

View solution in original post

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (3,485)