📅  最后修改于: 2022-03-11 15:00:21.048000             🧑  作者: Mango
DateTime startDate = DateTime.newInstance(2020,1,1,3,0,0);
DateTime endDate = DateTime.newInstance(2020,1,3,6,0,0);
Decimal minutes = Integer.valueOf((endDate.getTime() - startDate.getTime())/(1000*60));
System.debug('Minutes : ' + minutes);
Decimal hours = Integer.valueOf((endDate.getTime() - startDate.getTime())/(1000*60*60));
System.debug('Hours : ' + hours);
Decimal days = Integer.valueOf((endDate.getTime() - startDate.getTime())/(1000*60*60*24));
System.debug('Days : ' + days);