gpt4 book ai didi

java - 检查特定日期后收到的传真

转载 作者:行者123 更新时间:2023-12-01 13:49:43 26 4
gpt4 key购买 nike

所以这是一个旧代码,应该检查收到的传真,但由于某种原因我找不到错误。

 Calendar receivedAfter = Calendar.getInstance();
receivedAfter.add(Calendar.DAY_OF_YEAR, -14);

System.out.println();
System.out.println("Checking for received faxes since : " + receivedAfter);

我的输出是

检查自以下时间以来收到的传真:

java.util.GregorianCalendar[time=1386017803339,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="America/New_York",offset=-18000000,dstSavings=3600000,useDaylight=true,transitions=235,lastRule=java.util.SimpleTimeZone[id=America/New_York,offset=-18000000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2013,MONTH=11,WEEK_OF_YEAR=49,WEEK_OF_MONTH=1,DAY_OF_MONTH=2,DAY_OF_YEAR=336,DAY_OF_WEEK=2,DAY_OF_WEEK_IN_MONTH=1,AM_PM=1,HOUR=3,HOUR_OF_DAY=15,MINUTE=56,SECOND=43,MILLISECOND=339,ZONE_OFFSET=-18000000,DST_OFFSET=0]

为什么要打印出所有这些数据???有什么建议吗?

最佳答案

它是 GregorianCalendartoString() 方法的默认实现。

无需进行大量日期格式化的快速替代方案是:

 System.out.println("Checking for received faxes since : " + receivedAfter.getTime());

这为您提供了一个 java.util.Date 对象,它具有更人性化的 toString() 方法。

关于java - 检查特定日期后收到的传真,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20057908/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com