Java 中特定于语言环境的上午/下午指示符
特定于语言环境的上午/下午指示符为 AM/PM 标记指示符。
使用“p”转换字符来显示 AM/PM。
System.out.printf("Morning/afternoon indicator: %tp",d);示例
import java.util.Date;
public class Demo {
public static void main(String[] args) {
Date d = new Date();
System.out.printf("Morning/afternoon indicator: %tp",d);
System.out.printf("
Morning/afternoon indicator: %Tp",d);
}
}输出
Morning/afternoon indicator: pm Morning/afternoon indicator: PM
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP