选定区域,点右键,点设置单元格格式,选日期,再选择一个显示年月日时分秒的格式就可以了!
用公式显示=TEXT(A25,"YYYY-M-D H:MM:SS")
如果你用的是 Java8:
import java.time.Durationimport java.time.LocalTime
public class Test {
private static final LocalTime START = LocalTime.of(0, 0, 0)
public static void main(String[] args) throws Exception {
LocalTime time = LocalTime.parse("21:53:00")
LocalTime augment = LocalTime.parse("01:50:22")
LocalTime time2 = plusTime(time, augment)
System.out.println("time2: " + time2)
}
/**
* 在 current 的基础上增加 augment 所表示的时间(间隔)
*/
private static LocalTime plusTime(LocalTime current, LocalTime augment) {
Duration duration = Duration.between(START, augment)
return current.plus(duration)
}
}
运行:
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)