Incorrect formatting of date under Arabic (Algeria) culture - by Hristo Stoev

Status : 

 


1
0
Sign in
to vote
ID 776867 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 1/17/2013 11:31:02 PM
Access Restriction Public

Description

using the following code:

DateTime.Now.ToString("yyyy-MMM-dd ");

Framework formats the current date as yyyy-dd-MMM instead of yyyy-MMM-dd, please see attached sample.
Sign in to post a comment.
Posted by Microsoft on 2/5/2013 at 11:57 AM
The date is formatted correctly as yyyy-MMM-dd but because the month name for Algerian culture is in Arabic script, the resulted text will get rearranged according to Unicode BiDi algorithm when it gets rendered to the screen,. So the physical text is in the right form yyyy-MMM-dd but the visual text will look different. If you do DateTime.Now.ToString("yyyy") + “-“ + DateTime.Now.ToString("MMM") + “-“ + DateTime.Now.ToString("dd") you will get the same result although you are explicitly specifying each part separately.

If you want work around this issue you’ll need to insert one of the Unicode control characters so you may do the following
DateTime.Now.ToString("yyyy-MMM\u200E-dd")

Note that I have inserted LTR Unicode mark before the second dash

Posted by Helen [MSFT] on 1/18/2013 at 12:58 AM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Macy [MSFT] on 1/17/2013 at 11:50 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)