Watermark is not applying the local timestap, we are calling the API with local time by passing as string

Hi,

When we are calling aspose service for watermark, we are passing the date format in the form of string with converted local date.

But when the date is printed on the excel it is not showing the local date.
Please help us how can we set the local date format for watermark.

Thanks,
Manjula

@manjulaghanti,

Thanks for providing us some details.

Please note:

  1. When you apply built-in numbers formatting in code, the Date/Time values are converted in accordance with locale/regional settings of the system/environment when you open the output file into MS Excel there.

  2. If you apply custom numbers formatting in code, then the DateTime value would be independent and does not change with locale/regional settings.

Keep the above points in mind. Also, I am not entirely certain about your issue, so if you still have confusion/problem, kindly do provide more details, sample code (runnable) and sample files (input (if any) and output file, etc.), we will check it soon. Also provide a file with your expected DateTime in the cell, you may manually create the file in MS Excel. This will help us really to evaluate your issue precisely and to consequently figure it out soon.

PS. please zip the Excel files prior attaching.

Hi Amjad,

Thank you for the quick reply.
Below is the code to format i am using.

public String getTheFormattedSystemDateAndTime(String locale) {
ZoneId id = null;
if (StringUtils.isNotEmpty(locale)) {
id = ZoneId.of(locale);
}
// DateTimeFormatter dateTimeFormatter = getDateTimeFormatterBuilder().toFormatter();
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(“YYYY-MM-DD HH:mm:SS Z”);
ZonedDateTime zonedDateTime = ZonedDateTime.now(id != null ? id : ZoneId.systemDefault());
return zonedDateTime.format(dateTimeFormatter);
}

Thanks,
Manjula

I am not getting the correct time and local however date is retained correct in the watermark.

@manjulaghanti,

Thanks for the code segment.

Well. I am afraid, we cannot evaluate your issue (if there is any problem with Aspose.Cells for Java APIs) precisely based on your provided code segment. We need more details, complete sample code (runnable) and sample files (input (if any), output file by Aspose.Cells and your expected file, etc.), some screenshots to highlight the problem, etc., to reproduce the issue on our end.