cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Usernametwice23
Helper V
Helper V

Separating Date and Time columns

Hi all 

 

I have a single column that is date and time. I need the date and time separated so that when I export data to excel, they're in their own columns and it doesnt require me to re-create the date/time column as separate date and time columns in excel. 

 

Is their a way I can do this somehow? This is also crucial because the data gets exported to CSV and then saved as .txt and cant have date/time joined. 

 

Thanks for your help all. 

4 REPLIES 4
rampprakash
Super User
Super User

Hello @Usernametwice23,

 

As per OOB Behavior there is no Such behavior available in Dataverse Environment. 

 

Suggestion:

 

Create a New Field in Dataverse Environment GET the TIME from DateTime and Save it in that text, then while exporting export that row too..

 

You need to write below SCRIPT

 

function getTime(executionContext)
{
var formContext = executionContext.getFormContext();
var Date = formContext.getAttribute("DATETIMEFIELDLOGICALNAME").getValue();
var Hours = Date.getHours();
var Minutes = Date.getMinutes();
formContext.getAttribute("TEXTFIELDLOGICALNAME").setValue(Hours +":"+Minutes);
}

 

Please mark as Answer if it is helpful and provide Kudos


Subscribe : https://www.youtube.com/channel/UCnGNN3hdlKBOr6PXotskNLA
Blog : https://microsoftcrmtechie.blogspot.com

NHelgren
Power Apps
Power Apps

Dataverse does not have a Data Type for time only. @rampprakash has made a good suggestion below

@rampprakash Thanks for your help. Do you mind letting me know where to write these scripts? I did not know it was possible to do with Dataverse which is very interesting. Thanks again!

Hello @Usernametwice23,

 

You need to write this JS in ONCHANGE of the Date Field. Please find my Youtube for Step by step Guidence for how to write JS

 

https://www.youtube.com/watch?v=x8kYNCkikgs&t=14s

 

Please mark as Answer if it is helpful and provide Kudos


Subscribe : https://www.youtube.com/channel/UCnGNN3hdlKBOr6PXotskNLA
Blog : https://microsoftcrmtechie.blogspot.com

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (1,567)