cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ali_Nawaz
Helper III
Helper III

DateValue function malfunctioning in powerapps

Hi PowerUsers, I am trying to convert a text string into date  in powerapps by using DateValue function but it gives me a random date which is not the actual string which is passed to this function. 

I have a string like "30/04/2020" and I am trying to format it as "2020/04/30"
Passing this text directly in Text( ) function doesn't work, I have tried Text("30/04/2020", "[$-en-US]yyyy/mm/dd")

I know I have to pass it in DateValue function first to make this conversion but when I pass it to DateValue ( ) function the result is altogether wrong, I am trying this  Text(DateValue("30/04/2020"),"[$-en-US]yyyy/mm/dd"). It returns me this date "2022/06/04".

I am stuck on this thing, any workaround is appreciated. 
Looking forward to an early and helpful response. 

Regards,
Ali Nawaz

1 ACCEPTED SOLUTION

Accepted Solutions

@WarrenBelz Thanks I have tried your solution but somehow it does not work for me. 
Although I have found the workaround myself. 
I have put the "fr" string in the DateValue () function and it is working as intended now. 

Text(DateValue("30/05/2020","fr"),"[$-en-US]yyyy/mm/dd")


Regards,
Ali Nawaz

View solution in original post

5 REPLIES 5
WarrenBelz
Super User
Super User

Hi @Ali_Nawaz ,

You were close

Text(DateValue("4/30/2020"),"[$-en-US]yyyy/mm/dd")

We all use US dates apparently . . . just watch out for it possibly turning into your local format after about 30 seconds and then being invalid - just turn it back into US and it will be fixed - mine goes to Text(DateValue("4/30/2020"),"[$-en-AU]yyyy/mm/dd")

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

@WarrenBelz I am making this application for a client who is in German timezone. 
US format is not needed here. 

@Ali_Nawaz ,

I just added to my post - you need to use US for this format. This is nothing to do with Time Zone - it is about supported (by Power Apps) formats. I am in Australia and have to change mine all the time for anything other than our dd/mm/yyyy format.

DateValueText.png

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

@WarrenBelz Thanks I have tried your solution but somehow it does not work for me. 
Although I have found the workaround myself. 
I have put the "fr" string in the DateValue () function and it is working as intended now. 

Text(DateValue("30/05/2020","fr"),"[$-en-US]yyyy/mm/dd")


Regards,
Ali Nawaz

View solution in original post

@Ali_Nawaz ,

Obviously I could not test that from Australia. The issue was lining up the format and the region - I have to use US here as it will not accept AU and in doing so have to use US mm/dd/yyyy format. It is strange that it accepts fr and not de as you mentioned German requirements.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (2,490)