cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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.

View solution in original post

3 REPLIES 3
Super User
Super User

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.

View solution in original post

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
thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,007)