cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
prasadvenkat
Level: Powered On

Date issue in iPhone

I am having an issue where my code works correctly in Android phones and incorrectly in iPhone.

Here is my code:

*****************************************

Set(DateVar,DateValue(Left(AvlDatesListBox.Selected.DateNDay,Find("-",AvlDatesListBox.Selected.DateNDay))));

--A sample value for the DateNDay value is:  09/30/2019-Mon

*******************************************

This code works fine in Android phones and returns 9/30/2019 for DateVar value. But it does not work in iPhone and returns a blank value for DateVar

Any thoughts on what could be going wrong?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Date issue in iPhone

Hi @prasadvenkat ,

Based on the formula you provided, I found that there is something wrong with it. The Left(AvlDatesListBox.Selected.DateNDay,Find("-",AvlDatesListBox.Selected.DateNDay)) formula would return "09/30/2019-" (including '-' at the end) rather than "09/30/2019".

 

Please consider modify your formula as below:

Set(
DateVar,
DateValue(
Left(AvlDatesListBox.Selected.DateNDay, Find("-", AvlDatesListBox.Selected.DateNDay) - 1) /* <-- Modify formula here */
)
)

In additon, you could also consider take a try with the following formula:

Set(
    DateVar,
    DateValue(
              First(Split(AvlDatesListBox.Selected.DateNDay, "-")).Result   /* <-- Modify formula here */
    )
)

Please take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 REPLIES 3
mdevaney
Level 8

Re: Date issue in iPhone

@prasadvenkat 

While I don't have access to both Android and iPhone, I wonder if you could use the Text() function to format the datetime so it appears correctly on both mobile phones.  Try this:

 

Set(DateVar,Text(DateValue(Left(AvlDatesListBox.Selected.DateNDay,Find("-",AvlDatesListBox.Selected.DateNDay))),"m/d/yyyy");

 

The Text() function takes two arguments: the 1st is a date/number variable and the 2nd is formatting instructions in a text string format.  I think the result of the formula will now be 9/30/2019 on both phones.  Let me know

Community Support Team
Community Support Team

Re: Date issue in iPhone

Hi @prasadvenkat ,

Based on the formula you provided, I found that there is something wrong with it. The Left(AvlDatesListBox.Selected.DateNDay,Find("-",AvlDatesListBox.Selected.DateNDay)) formula would return "09/30/2019-" (including '-' at the end) rather than "09/30/2019".

 

Please consider modify your formula as below:

Set(
DateVar,
DateValue(
Left(AvlDatesListBox.Selected.DateNDay, Find("-", AvlDatesListBox.Selected.DateNDay) - 1) /* <-- Modify formula here */
)
)

In additon, you could also consider take a try with the following formula:

Set(
    DateVar,
    DateValue(
              First(Split(AvlDatesListBox.Selected.DateNDay, "-")).Result   /* <-- Modify formula here */
    )
)

Please take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
prasadvenkat
Level: Powered On

Re: Date issue in iPhone

great..thx.  worked perfect for me. I like the split function.. din't realize powerapps has a split like in traditional scripting languages

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 392 members 4,876 guests
Please welcome our newest community members: