e369. getting the current time.txt

来自「这里面包含了一百多个JAVA源文件」· 文本 代码 · 共 10 行

TXT
10
字号
Calendar cal = new GregorianCalendar();
    
    // Get the components of the time
    int hour12 = cal.get(Calendar.HOUR);            // 0..11
    int hour24 = cal.get(Calendar.HOUR_OF_DAY);     // 0..23
    int min = cal.get(Calendar.MINUTE);             // 0..59
    int sec = cal.get(Calendar.SECOND);             // 0..59
    int ms = cal.get(Calendar.MILLISECOND);         // 0..999
    int ampm = cal.get(Calendar.AM_PM);             // 0=AM, 1=PM

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?