Showing results for 
Search instead for 
Did you mean: 
Post Patron
Post Patron

Date value

Hi, I have a problem with my date value. I patch the date requested (in text label)  from canvas apps back to cds. However, the date become one day less than the one requested from canvas apps. why is that? 

Community Champion
Community Champion



Because it could depend on the behavior of the date field in CDS


You can check here:


Date and time field behavior and format

The following table contains information about the date and time field behavior and format.

Behavior Format Description
User LocalDate Only
- or -
Date and Time
This is the default behavior of custom date and time fields.

The field values are displayed in the current user’s local time.
In Web services, these values are returned using a common UTC time zone format.

You can change this one time if you select the default behavior. More information Change User Local Behavior
Date OnlyDate OnlyNo Time zone conversion.

The time portion of the value is always 12:00AM.
The date portion of the value is stored and retrieved as specified in the UI and Web services.
Time-Zone IndependentDate Only
- or -
Date and Time
No Time zone conversion.

The date and time values are stored and retrieved as specified in the UI and Web services.

But why is that when I patch the date based on the editform of the entity,the date value stays the same in the cds and the canvas apps?



This could potentially be because there may be a difference in how the date is interpreted when patching from Text and patching from Date control. if the CDS is also a Date control (we are presuming it is - is this true?) and you patched from a Text label, we think you may be getting results that are not consistent. 


You could try following :


  1. Add a Date Picker control (it is under Home -> Input)
  2. Under property DefaultDate (of the DatePicker) put this
    1. DateTimeValue(YourLabelWithTextDateOnIt.Text)
  3. To be clear understanding of this and seeing the full interpreted date and time for testing, try setting  Format property (yes, on the DatePicker again) to this:
    1. DateTimeFormat.ShortDateTime
  4. Under DateTimeZone (of the DatePicker) choose Local or UTC and play with the difference patching with one and the other.
  5. Try to patch with the DatePicker control value if possible instead of the Text label directly because you may get more consistent results if patching from the DatePicker control.

But I have a condition for the date requested, which is the user can choose the default days (how many days) for shipping. That's why I use the text field. The date I'm patching back to cds is = datevalue + default days



You could also try just adding the Date to the number of days instead of using a Text Label.





DateAdd( YourDateTimeFromDatePicker, Value(NumberOfDaysFromOtherField.Text) )



Reason you do Value(NumberOfDaysFromOtherField.Text) for the second argument is because if you are using DateAdd and  the second argument has to be a number - Value(NumberOfDaysFromOtherField.Text) converts Text to Number. If the other control reference is already a number, then you may not need to wrap Value function around it and possibly can use it directly. If the number is in an input field then it may need to have Value wrapped around it like above example.


The above example DateAdd returns a new Date/Time value with the number of days added. Then you would patch this instead of the text value, in order to patch a Date without needing to patch a Text value. So you can use that entire DateAdd statement above (and change it slightly for your case) instead of having to use a Text label to store the date.

I've used this formula, the date it return back to cds is still one day less than the one in canvas apps. 



Try playing with the UTC conversion to and from of the date in PowerApps Canvas App, right before patching it, and see if you can get the dates to align if you send it as a current UTC date and time, etc.:

Converting to UTC

To convert to UTC (Coordinated Universal Time), add the TimeZoneOffset for the given time.

For example, imagine the current date and time is July 15, 2013, 1:02 PM in Pacific Daylight Time (PDT, UTC-7). To determine the current time in UTC, use:

  • DateAdd( Now(), TimeZoneOffset(), Minutes )

TimeZoneOffset defaults to the current time, so you don't need to pass it an argument.

To see the result, use the Text function with the format dd-mm-yyyy hh:mm, which will return 15-07-2013 20:02.

Converting from UTC

To convert from UTC, subtract the TimeZoneOffset (by adding the negative) for the given time.

For example, imagine the UTC date and time July 15, 2013, 8:02 PM is stored in a variable named StartTime. To adjust the time for the user's time zone, use:

  • DateAdd( StartTime, −TimeZoneOffset( StartTime ), Minutes )

Note the negative sign before TimeZoneOffset to subtract the offset rather than add it.

To see the result, use the Text function with the format dd-mm-yyyy hh:mm, which will result in 15-07-2013 13:02 if you're in Pacific Daylight Time.



Community Support
Community Support


Could you share the Date field setting and formulas generated the date?

This seems to be a Timezone issue, but I cannot reproduce the issue.

Hope you can share more information


If(Toggle1.Value=true,DateAdd(DateValue7.SelectedDate,Value(Label18.Text)), DateAdd(DateValue8.SelectedDate,Value(Label19.Text)))


this is the formula I use to generate my date.

Helpful resources

UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,976)