如何将datetime中英文文本中的月份名称转换为C#中的阿拉伯文本? [英] How to convert the month name in english text in datetime to arabic text in C#?

查看:270
本文介绍了如何将datetime中英文文本中的月份名称转换为C#中的阿拉伯文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的日期显示于2013年7月12日。我使用的格式为dd MMMM yyyy。我想用阿拉伯语文本显示月份文本,即7月。反正呢?



我收到يوليه而不是يوليو,我的客户说:7月是阿拉伯语中的يوليو,而在网站上它显示为يوليه 。哪个错了,

有谁可以帮我这个?



请找到下面的代码。



我的尝试:



CultureInfo uiCulture1 = CultureInfo.CurrentUICulture; //'ar-AE'

DateTime dDateTime2 = DateTime.Parse(dt.ToString(),uiCulture1,System.Globalization.DateTimeStyles.AssumeLocal);

lblDate.Value = dt.ToString(dd MMMM yyyy);

I have a date which is displayed on 12 July 2013. I am using the format "dd MMMM yyyy". I want to display the month text i.e. July in Arabic text. Is there anyway?

Am getting يوليه as result instead يوليو, My client, saying : the month of July is "يوليو" in Arabic, while on the website it is showing as "يوليه". Which is wrong,
can anyone help me on this?

Please find the code below.

What I have tried:

CultureInfo uiCulture1 = CultureInfo.CurrentUICulture; //'ar-AE'
DateTime dDateTime2 = DateTime.Parse(dt.ToString(), uiCulture1, System.Globalization.DateTimeStyles.AssumeLocal);
lblDate.Value = dt.ToString("dd MMMM yyyy");

推荐答案

使用此

use this
var date = DateTime.Now.ToString("dd/MMM/yyyy",new CultureInfo("ar"));


这篇关于如何将datetime中英文文本中的月份名称转换为C#中的阿拉伯文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆