2024-05-05 08:15:00
, and the second condition is met:2024-05-05 08:15:00
into the CSV file in Excel, the value of str is2024-05-05 08:15:00
, and the thrid condition an't be met, because the seconds are lobbed off by the time it gets from the Excel CSV to Java and throws a java.text.ParseException:5/5/2024 8:15
If edited and saved by Excel: 5/5/2024 8:15
java.text.ParseException: Unparseable date: "5/5/2024 8:15"
at java.base/java.text.DateFormat.parse(DateFormat.java:396)
at com.dandylabs.FeedbackBannedIPBeanPopulator.populateBean(FeedbackBannedIPBeanPopulator.java:104)
at com.dandylabs.FeedbackBannedIPUpdater.readCSV(FeedbackBannedIPUpdater.java:282)
at com.dandylabs.FeedbackBannedIPUpdater.perform(FeedbackBannedIPUpdater.java:264)
at com.dandylabs.FeedbackBannedIPUpdater.main(FeedbackBannedIPUpdater.java:307)
Carey Brown wrote:In Excel, what is the FORMAT of the date/time cell?
5/5/2024 08:15:00 AM
Your code snippet is incomplete. You are not using MDY_HMS_SQL_FULL_SDF for instance. We don't know what's in StringUtilities or DateUtilities.Phillip Powell wrote:
Carey Brown wrote:You can set a custom format in Excel to "m/d/yyyy h:mm:ss" that will not truncate seconds.
. . . and please reserve // comments for things very short. Your long comments should be broken into multi‑line /* comments */Carey Brown wrote:. . . please keep line lengths short . . .
I guess everyone has an angle. Fine, what do you want? Just know that you cannot have this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|