We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

After export as Excel time fields are showing seconds but i want to see it in only Hours and Minutes

kranthi2
Tera Expert

Hi,

After export as Excel time fields are showing seconds but i want to see it in only Hours and Minutes.

 

kranthi2_0-1702280472971.png

 

kranthi2_1-1702280490775.png

 

I want to see in the Excel only Hours and minutes.

 

Please help me out on the same.

 

Thanks,

 

 

6 REPLIES 6

Dr Atul G- LNG
Tera Patron

Hi @kranthi2 

 

OOTB it is not possible but once you download in excel we can 

  1. To convert time to a number of hours, multiply the time by 24, which is the number of hours in a day.
  2. To convert time to minutes, multiply the time by 1440, which is the number of minutes in a day (24*60).
  3. https://www.ablebits.com/office-addins-blog/excel-convert-time-decimal/
*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG

****************************************************************************************************************

I want only HH:MM format is it possible in Excel file.

 

Thanks,

 

Hi @kranthi2 

 

Yes, but give a try. Search on google , you will get options and it is do able. 

*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG

****************************************************************************************************************

Ankur Bawiskar
Tera Patron

@kranthi2 

that's because internally duration field holds value in seconds

Workaround is this: Please discuss with your customer about this as you are creating a custom field on OOB table i.e. task_sla

1) create custom string field on your table (task_sla), make it read-only at dictionary level

2) add this script in the calculated field of that string field

(function calculatedFieldValue(current) {

	// Add your code here
	var dur = new GlideDuration();
	dur.setValue(current.duration);
	return dur.getDisplayValue();

})(current);

AnkurBawiskar_0-1702295356157.png

 

3) then use this in export

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader