Products
GG网络技术分享 2025-11-14 04:18 1
java import java.text.SimpleDateFormat; import java.util.Date;
public class DateFormatExample { public static void main { // 获取当前日期和时候 Date now = new Date; // 创建SimpleDateFormat对象,指定日期格式 SimpleDateFormat sdf = new SimpleDateFormat; // 将Date对象格式化为字符串 String nowStr = sdf.format; // 打印格式化后的日期和时候 System.out.println; } }

Demand feedback