怎么在Excel里显示年月日时分秒

怎么在Excel里显示年月日时分秒,第1张

选定区域,点右键,点设置单元格格式,选日期,再选择一个显示年月日时分秒的格式就可以了!

用公式显示=TEXT(A25,"YYYY-M-D H:MM:SS")

如果你用的是 Java8:

import java.time.Duration

import 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)

    }

}

运行:


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/bake/11759937.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-18
下一篇 2023-05-18

发表评论

登录后才能评论

评论列表(0条)

保存