Team,
I am having text field in SharePoint list. In that the datetieme value is saved as string. For Ex. 7/22/2019 06:05.
I want to bind this value in date pciker control in power apps form.
I tried the below approach but it is not working properly if the time is less than 12 hours.
If(EditFormShiftDetails.Mode=FormMode.New,Hour(Now()),Text(Hour(DateTimeValue(DateText)),"[$-en-US]00"))
DateText is the internal field in SharePoint list. Please help me.
Thanks
Philip
Solved! Go to Solution.
Hi Shilendra,
I just swap the if condition and it started working.
If(EditFormShiftDetails.Mode=FormMode.Edit, Text(Minute(DateTimeValue(DateText)),"[$-en-US]00"), Minute(Now()))
With Split function
If(EditFormShiftDetails.Mode=FormMode.Edit,Last(Split(Last(Split(DateText, " ")).Result, ":")).Result, Minute(Now()))
Thanks for your support.
Thanks
Philip
HI @Anonymous
To get the time from datetime value you can do the following:
Text(DateTimeValue(DateText), "[$-en-US]hh:mm")
for all formats you can refer to - https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-text
Thanks.
Hi Shilendra,
It is not working. It is displayed as 00 in hour drop down.
If(EditFormShiftDetails.Mode=FormMode.New,Hour(Now()),Text(DateTimeValue(DateText),"[$-en-US]hh:mm"))
Thanks
Philip
Hi @Anonymous
what is the value in DateText
Thanks.
Hi Shilendra,
The value of DateText field is 7/23/2019 06:05
Hi Shilendra,
If the hour value is greater than or equal to 12 hours, then the below option formula is working.
Text(DateTimeValue(DateText),"[$-en-US]hh")
If the hour is less than 12, then it is displayed as 00.
Any idea? Please help me.
Thanks
Philip
Hi Shilendra,
I am having the field like below and it is hidden from the screen. The internal name of the field is DateText. If I used the below formula, I am getting the syntax error as "This rule creates a circular reference between properties, which is not allowed. A property cannot reference itself or other properties affected by its value.".
If(EditFormShiftDetails.Mode=FormMode.New,Hour(Now()),Text(Hour(DateTimeValue(StartTimeTextInput.Text)), "[$-en-US]hh"))
Any idea? Please help.
Thanks,
Philip
Hi @Anonymous
To which control are you assigning the below formula. Looks like both DateText and StartTimeInput refer to the same datacard and you are setting the below formual to StartTiimeInput control and so circular reference.
Thanks.
Hi Shilendra,
I am trying to setup the formula in different data card, not in the StartTimeInputText datacard.
I am able to get the hour value in text box or label. But it is not setting to drop down.
Thanks
Philip
Hi Shilendra,
If I used the below formula, it is setting the correct value.
Text(Hour(DateTimeValue(DateText)), "[$-en-US]00")
If I set the below formula based on the form mode, then it is displayed as 00 for the hour less than 12.
If(EditFormShiftDetails.Mode=FormMode.New,Hour(Now()),Text(Hour(DateTimeValue(DateText)),"[$-en-US]00"))
Any idea or suggestion please?
Thanks
Philip
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
User | Count |
---|---|
192 | |
67 | |
46 | |
41 | |
22 |
User | Count |
---|---|
246 | |
120 | |
83 | |
74 | |
69 |