捷克共和国日期格式问题 [英] czech republic date format issue

查看:128
本文介绍了捷克共和国日期格式问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好先生,

帮助我获得日期格式的解决方案吗?

i有一个下拉列表,它绑定了不同的文化

english, polski,捷克共和国等......

在项目中我们使用这种格式为date => MMM dd,yyyy

所有文化都是完整的工作和显示日期2014年9月11日

除了一种文化 捷克共和国

这种格式的捷克共和国偶像09 11,2014

i google google with more more时间bt我只有那个

这种文化只有两种格式dmyy,d.mm.yyyy,dd.mmmm.yyyy

这种文化不支持月份的简称。

喜欢,jan,feb,sep,oct等..

和i complsry在项目中显示这个日期格式

请帮助我用捷克共和国获得短月名称

请给我一些想法,提示,如何解决这个问题?

thanx

解决方案

除了 Abhinav [ ^ ],i建议阅读:

概述全球化和本地化 [ ^ ]

ASP.NET全球化和本地化 [ ^ ]

自定义日期和时间格式字符串 [ ^ ]


正如我在评论中所说,捷克语没有月份名称缩写的标准化列表。这很可能是微软选择使用罗马数字作为MMM格式的原因。但是你创建了自己的格式来支持短月份名称。

  var  czechCulture =  new  System.Globalization.CultureInfo(  cs-CZ) ; 
var customDateTimeFormatInfo =(System.Globalization.DateTimeFormatInfo)czechCulture.DateTimeFormat.Clone();

var czechMonthAbbreviations = new [] {
led。 úno。 bře。 dub。 kvě。 čvn。 čvc。 srp。 zář。 říj。 lis。 pro。
};

customDateTimeFormatInfo.AbbreviatedMonthNames = czechMonthAbbreviations;
customDateTimeFormatInfo.AbbreviatedMonthGenitiveNames = czechMonthAbbreviations;

DateTime.Now.ToString( dd MMM yyyy,customDateTimeFormatInfo) .Dump();



这些缩写应该是可以理解的,但要注意这不是你用捷克语写日期的方式。从技术上讲,你也应该设置格式形式,但试图将其压缩成3个字母会产生类似čce的东西。对于七月来说,这会使读者一开始就认真思考然后翻白眼。


你问了一个类似的问题这里 [ ^ ]之前。

尝试

 Console.WriteLine(date1.ToString(  MMMM dd YYYY,CultureInfo.CreateSpecificCulture(  cs-CZ ))); 


Hello sir,
help me to get solution for date format ?
i have a dropdownlist which is bind the different cultures
english, polski, czech republic, etc...
in project we used this format for date => MMM dd, yyyy
all cultures are completely work and display date with this format "Sep 11, 2014"
except one culture "Czech republic".
czech republic diplays with this format "09 11, 2014"
i search on google with taken more time bt i only got that
this culture havae only two formats d.m.yy, d.mm.yyyy, dd.mmmm.yyyy
this culture does not support month's short name.
like, jan, feb,sep, oct,etc..
and i complsry to display this date format in project
pls help me to get short month name with czech republic
pls give me some ideas, hints, that how to solved this ??
thanx

解决方案

In addition to Solution1 by Abhinav[^], i'd suggest to read this:
Overview of Globalization and Localization[^]
ASP.NET Globalization and Localization[^]
Custom Date and Time Format Strings[^]


As I already said in my comment Czech language doesn't have a standardized list of month name abbreviations. That is most probably the reason Microsoft chose to use roman numerals for MMM format. But you create your own format to support short month names.

var czechCulture = new System.Globalization.CultureInfo("cs-CZ");
var customDateTimeFormatInfo = (System.Globalization.DateTimeFormatInfo)czechCulture.DateTimeFormat.Clone();

var czechMonthAbbreviations = new [] {
"led.","úno.","bře.","dub.","kvě.","čvn.","čvc.","srp.","zář.","říj.","lis.","pro.",""
};

customDateTimeFormatInfo.AbbreviatedMonthNames = czechMonthAbbreviations;
customDateTimeFormatInfo.AbbreviatedMonthGenitiveNames = czechMonthAbbreviations;

DateTime.Now.ToString("dd MMM yyyy", customDateTimeFormatInfo).Dump();


These abbreviations should be understandable but be aware this is not how you would write date in Czech. Technically you should set the genitive form as well but trying to squeeze that into 3 letter would produce something like "čce." for July which would make the reader think hard at first and then roll his eyes.


You asked a similar question here[^] before.
Try

Console.WriteLine(date1.ToString("MMMM dd YYYY",CultureInfo.CreateSpecificCulture("cs-CZ")));


这篇关于捷克共和国日期格式问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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