cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bean
Continued Contributor
Continued Contributor

DateTime format into CDS

Hi,

 

I've trying to pass a date and time value to common data service, but haven't got the format correct?

 

In my CDS I have DateTime field, and am trying to store to it.

 

Here is a screenshot of my code - see the datetimes at bottom:

code.png

 

And the error I am recieving in flow:

datetime.png

 

Why am I doing it via flow? - is the way I'd like to tackle it

theflow.png

All help very much appreciated.

 

Cheers,

Sean

1 ACCEPTED SOLUTION

Accepted Solutions
v-yamao-msft
Community Support
Community Support

Hi bean,

 

According to your description, I create a custom entity which has a DateTime field. To get the proper format of the DateTime field, I open the entity in an Excel. Then I got the format of the DateTime field. It is using the UTC format.

3.PNG

 

Then I create a simple flow to test this issue. The flow is configured likes following:

4.PNG

 

On the app, I add a button, a Textinput control, a Datepicker control, and a Dropdown control(There is a Picklist in my entity).
Then add the flow on the button, set the button’s OnSelect property as:

'PowerApp->Createanewrecord'.Run(TextInput1.Text,Text(DatePicker1.SelectedDate,DateTimeFormat.UTC),Dropdown1.Selected.Value)


In the code, I use a Text function to convert the datetime to UTC format. And it works fine.

5.PNG

 

 

Please take it for a reference.

 

Best regards,
Mabel Mao

Community Support Team _ Mabel Mao
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

1 REPLY 1
v-yamao-msft
Community Support
Community Support

Hi bean,

 

According to your description, I create a custom entity which has a DateTime field. To get the proper format of the DateTime field, I open the entity in an Excel. Then I got the format of the DateTime field. It is using the UTC format.

3.PNG

 

Then I create a simple flow to test this issue. The flow is configured likes following:

4.PNG

 

On the app, I add a button, a Textinput control, a Datepicker control, and a Dropdown control(There is a Picklist in my entity).
Then add the flow on the button, set the button’s OnSelect property as:

'PowerApp->Createanewrecord'.Run(TextInput1.Text,Text(DatePicker1.SelectedDate,DateTimeFormat.UTC),Dropdown1.Selected.Value)


In the code, I use a Text function to convert the datetime to UTC format. And it works fine.

5.PNG

 

 

Please take it for a reference.

 

Best regards,
Mabel Mao

Community Support Team _ Mabel Mao
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

Helpful resources

Announcements
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 (3,151)