I have date picker set to UTC. It works on New form but every time I go to Edit, it shows blank.
Data card - Default property
If(
IsBlank(ThisItem.'Date (UTC)'),
Now(),
DateAdd(
Date(
1900,
1,
1
),
ThisItem.'Date (UTC)',
Days
)
)
Update
dateUTC.SelectedDate
hello @biancadevera ,
I assume you are storing data in SharePoint? Are you storing with the patch function or are you using a form and the submitform function?
maybe you could send a screenshot of your structural view. So we understand the cotnext better.
With regards
Kevin
hello again @biancadevera
I tried to build an editform with a datecolumn and use the forms.
As you can see on the picture below on the editform I just used the field value when the value is not blank, otherwise I take now()
Your approach did not work for the edit form.
With regards
Kevin
We can do multiple ways,
#1 FormMode
If(EditForm1.Mode=FormMode.New, Now(), Parent.Default)
#2 Using Parent.Default - IsBlank
If(IsBlank(Parent.Default), Now(), Parent.Default)
#3
If(IsBlank(ThisItem.'Date (UTC)'), Now(), ThisItem.'Date (UTC)')
Thanks,
Stalin - Learn To Illuminate
Hi @StalinPonnusamy I tried the 3rd option you provided and the value shows up now. However, it goes back at least 1 day. Like when I saved the entry in 11/20/2021 it shows 11/19/2021 in Edit form. Note that I use UTC time for my date picker.
The system always stores the DateTime value as UTC in the backend. And setting as local for the Date picker always helps. Any reason why you are using UTC timezone as a date picker?
To convert the local to UTC
DateAdd(Now(), TimeZoneOffset(), Minutes )
Wise versa, convert UTC to Local
DateAdd( Now(), -TimeZoneOffset(), Minutes )
Here is the documentation for TimeZone
Thanks,
Stalin - Learn To Illuminate
Hi @powercorner
I'm using submitform function. The now() seems to work but what if I selected previous dates? It goes back 1 day in Editform. Basically, here's what I want:
I'm able to replicate the same issue that you described. Thanks for the explanation. Please try this.
If(IsBlank(ThisItem.'Date (UTC)'), DateAdd(Now(), TimeZoneOffset(), Minutes), DateAdd(ThisItem.'Date (UTC)', TimeZoneOffset(), Minutes) )
DateAdd(DateControlName.SelectedDate, TimeZoneOffset(), Minutes)
Thanks,
Stalin - Learn To Illuminate
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
187 | |
52 | |
51 | |
36 | |
32 |
User | Count |
---|---|
282 | |
97 | |
89 | |
82 | |
77 |