I have Excel file with a date time record with this format “9/24/2009 12:46:45 PM”. But in Pega it is showing without seconds.
Used FormatDateTime() to convert it.
Please provide a solution to display it with seconds.
I have Excel file with a date time record with this format “9/24/2009 12:46:45 PM”. But in Pega it is showing without seconds.
Used FormatDateTime() to convert it.
Please provide a solution to display it with seconds.
@VINDYATD Its strange that i too faced the same issue. Never noticed this in detail though before.
The format (01/17/2026 04:24 AM) where if we don’t give seconds, the parsing works fine without any additional code and able to save the data to DB as well.
But if you have seconds in the date, 09/24/2009 02:46:45 AM i was able to get the parsed value in the pagelist, but unable to save the same to DB (Getting not a valid date time value).
I tried to give some parameters like Param.EXCEL_DATE_TIME = “MM/dd/yyyy hh:mm:ss a” before calling pxParseExcelFile activity. But it din’t work.
So, i had to write a custom function to parse this date time string with certain pattern and converted the date string to GMT timezone and then i was able to get the data to get displayed on the UI and also save to DB
String format = "MM/dd/yyyy hh:mm:ss a";
String dateTimeString = "09/24/2009 02:46:45 AM";
LocalDateTime ldt = LocalDateTime.parse(dateTimeString, DateTimeFormatter.ofPattern(format, Locale.ENGLISH));
String strTimeZone = tools.findPage("pxRequestor").getString(".pyUseTimeZone");
ZonedDateTime zdt = ldt.atZone(ZoneId.of(strTimeZone));
String result = zdt.format(DateTimeFormatter.ofPattern("yyyyMMdd'T'HHmmss.SSS z")); // This is pega standard GMT date time format
Input Excel data
Parsed Data on the UI pulled from DB post save
Not sure if this is a known OOTB issue. I implemented this in Pega v 25.1.1
Hope this helps
Regards
JC