如何将我的变量内容转换为英语? [英] How can I convert my variable content to english?

查看:101
本文介绍了如何将我的变量内容转换为英语?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



i从html文本框(datepicker)得到两个日期:


i got two date from html textbox(datepicker) :

string from = fromDate1.Value;
string to = toDate1.Value;




string city = TextBox1.Text;





我将它们发送到另一页:



and i send them to another page by :

Response.Redirect(string.Format("search.aspx?c={0}&from={1}&to={2}",HttpUtility.UrlEncode(city),HttpUtility.UrlEncode(from),HttpUtility.UrlEncode(to)));



之后我得到它们在目标网页中:


after that i got them in the destination page :

string from = Request.QueryString["from"];
string to = Request.QueryString["to"];

他们的内容=> (从:1395/04/01,到:1395/04/15)

日期是在perisan。



怎么样我将数字转换为英文?

我如何将字符串变量转换为日期?



我尝试了什么:



这是我在大学项目中的一小部分而且我完成了除了这一项之外的所有工作!

我的项目是喜欢预订。

i想要检查用户插入时房间是否为空...

else

do

...
$ b $不能使用datetime。

content of them => (from : ۱۳۹۵/۰۴/۰۱ , to : ۱۳۹۵/۰۴/۱۵ )
numbers of date are in perisan.

how can i convert numbers to english?
and how can i convert string variable to date?

What I have tried:

this is a little part of my project in the university and i done all of the except this one!
my project is like booking.
i want to check if the room is empty in the time who user inserted do ...
else
do
...
i cant work with datetime.

推荐答案

如果你不能使用DateTime,你就没有选择。好吧,除了使用翻译语言之间的外部服务。 .NET Framework中没有任何内容可以为您执行此操作。
If you cannot use a DateTime, you have no options. Well, besides using an external service that translates between languages. There is nothing in the .NET Framework that does this for you.


要转换西方和波斯语样式之间的数字,请参阅 c# - 从西方阿拉伯数字转换数字& quot; 1,2,3 ...& quot; to Eastern Arabic Digits& quot; 1,2,3 ....& quot; - Stack Overflow [ ^ ]。

要从字符串生成 DateTime ,必须使用 DateTime。解析功能。
For converting the digits between Western and Persian styles, see c# - Converting Numbers from Western Arabic Digits "1,2,3..." to Eastern Arabic Digits "١, ٢, ٣...." - Stack Overflow[^].
For generating a DateTime from a string, you must use the DateTime.Parse function.


这篇关于如何将我的变量内容转换为英语?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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