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

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
Highlighted
Community Support
Community Support

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
Highlighted
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

Highlighted
Community Support
Community Support

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

Highlighted
Helper I
Helper I

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
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,844)