Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hello guys i'm using globalization and localization in my application. i'm using 2 cultures english and arabic,
all the things are working perfectly but i'm facing issue in Date

in a list to records populated in JQuery Datatable when my application is in english then the date is showing correctly like 21/08/2017.
when i click on arabic and things are changed to arabic the date converted to this date 29/11/2038. i dont know why this is happening kindly help me solve this issue.

What I have tried:

tried on google but did not find any appropriate solution
Posted
Updated 7-Aug-17 0:00am

That because the local for your Arabic culture displays dates according to the Islamic calendar (with a little bug)...
The 21/08/2017 is the 29th of Hijja 1438...
Hijja is the 12th month of the Islamic calendar (with zero based it comes to 11) and because of the bug of 1900-2000, 38 displayed as 2038, instead of 1438...
 
Share this answer
 
Comments
UnStable Messi 8-Aug-17 5:06am    
i just changed ar-SA to ar-BH then problem is gone :)

Thankyou
Gregorian 21/08/2017 would be Hijri 29/11/1438. So you got a wrong year.

This may be sourced by using a date format internally that is Gregorian and does not support "old" dates (and it might also print "invalid" when the conversion creates invalid Gregorian dates).

A possible solution might be holding dates as Gregorian and using a conversion function that creates a Hijri date string representation instead of creating a "binary" Hijri date and formatting that.

But we can't help without knowing which formats and which conversion functions are used.
 
Share this answer
 
Comments
UnStable Messi 8-Aug-17 5:06am    
i just changed ar-SA to ar-BH then problem is gone :)

Thankyou

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900