(1)String类格式化当前日期
来源:互联网 发布:杨幂和唐嫣友情知乎 编辑:程序博客网 时间:2024/05/24 07:37
import java.util.Date;
import java.util.Locale;
public class Example {
public static void main(String[] args)
{
Date today=new Date();
String a=String.format(Locale.US,"%tb",today );//格式化后的字符串为对月份的英文缩写
System.out.println("格式化后的字符串为月份的英文缩写:"+a);
String b=String.format(Locale.US,"%tB",today);//格式化后的字符串为月份的英文全写
System.out.println("格式化后的字符串为英文的全写"+b);
String c=String.format("%ta", today);//格式化后的字符串为星期(如星期一)
System.out.println("月格式化后的字符串为星期:"+c);
String d=String.format("%tA", today);//格式化后的字符串为星期(如星期二)
System.out.println("格式化后的字符串为星期:"+d);
String e=String.format("%tY", today);//格式化后的字符串为4位的年份值
System.out.println("格式化后的字符串为4位年份值"+e);
String f=String.format("%ty",today);//格式化后的年份为两位的年份值
System.out.println("格式化后的年份为两位的年份值"+f);
String g=String.format("%tm", today);//格式化后的字符串为2位的月份值
System.out.println("格式化后的字符串为2位的月份值"+g);
String h=String.format("%td",today);//格式化后的字符串为两位的日期值
System.out.println("格式化后的字符串为2位的日期值"+h);
String i=String.format("%te",today);//格式化后的字符串为1位的字符串
System.out.println("格式化后的字符串为1位的日期值 "+i);
}
}
import java.util.Locale;
public class Example {
public static void main(String[] args)
{
Date today=new Date();
String a=String.format(Locale.US,"%tb",today );//格式化后的字符串为对月份的英文缩写
System.out.println("格式化后的字符串为月份的英文缩写:"+a);
String b=String.format(Locale.US,"%tB",today);//格式化后的字符串为月份的英文全写
System.out.println("格式化后的字符串为英文的全写"+b);
String c=String.format("%ta", today);//格式化后的字符串为星期(如星期一)
System.out.println("月格式化后的字符串为星期:"+c);
String d=String.format("%tA", today);//格式化后的字符串为星期(如星期二)
System.out.println("格式化后的字符串为星期:"+d);
String e=String.format("%tY", today);//格式化后的字符串为4位的年份值
System.out.println("格式化后的字符串为4位年份值"+e);
String f=String.format("%ty",today);//格式化后的年份为两位的年份值
System.out.println("格式化后的年份为两位的年份值"+f);
String g=String.format("%tm", today);//格式化后的字符串为2位的月份值
System.out.println("格式化后的字符串为2位的月份值"+g);
String h=String.format("%td",today);//格式化后的字符串为两位的日期值
System.out.println("格式化后的字符串为2位的日期值"+h);
String i=String.format("%te",today);//格式化后的字符串为1位的字符串
System.out.println("格式化后的字符串为1位的日期值 "+i);
}
}
- (1)String类格式化当前日期
- String类格式化当前日期
- Java使用String类格式化当前日期
- 字符串处理技术之格式化字符串(String类格式化当前日期)
- 格式化当前日期
- 格式化当前日期
- 当前日期格式化
- js-格式化当前日期
- string.Format 格式化日期
- string.format 日期格式化
- java 格式化输出当前日期
- java 格式化当前日期有误
- Java获取当前格式化日期
- mysql当前时间,日期转换,日期格式化
- 用CTime类得到当前日期、时间、星期,格式化
- 用CTime类得到当前日期、时间、星期,格式化
- CTime类得到当前日期、时间、星期,格式化(详细讲解)
- 用CTime类得到当前日期、时间、星期,格式化
- 应该掌握的一些算法
- Linux多线程
- Algorithmic Implementation series(6) Implementation of Quick_Sort
- Tomcat配置的一点注意
- 黑马程序员之银行业务调度系统
- (1)String类格式化当前日期
- (2)九九乘法表
- android请求的两种方式
- Word技巧
- java--解决矩形排序(Set集合运用)
- 【mfxp.com】高手分享:轻松搞定硬盘“HDD Not Detected”错误提示
- JMS学习
- Struts2里.do的后缀无法访问的解决方法
- 【xp系统下载】用Excel做个工程倒计时牌