Reputation: 15
I have a screen where I should search based on a particular date range.
When I try to search within the date range in my local host (connected to production database) I am getting the expected result. Whereas in the production (also connected to the same database) no search results has been found for the date range.
The problem that I found was that the date format in my local host looks like
01-Feb-2018
whereas in production the date format is 01-febr.-2018
. I am sure the problem is here but not sure of how the format is changing for the production alone. I have changed the format of date in Java like:
if(packingMobileHdrTO.getFromDate() != null )
{
fromDate = DATE_FORMATTER_DD_MMM_YYYY.format(packingMobileHdrTO.getFromDate());
}
Upvotes: 0
Views: 235
Reputation: 140318
The locale is set differently in prod vs your local machine.
Set them to the same, either:
Locale.setDefault(...)
DATE_FORMATTER_DD_MMM_YYYY
(which is the most robust option, if the dates have to be in a specific format).Upvotes: 4