Dec 28, 2015, 7:44 PM
Ext.Date.parse
it's possible to identify the cultures that use AM and PM designators by running the following code
Parsing a date using Ext.Date.parse works on English, English (Australia) and Chinese (Traditional, Taiwan)
English - en - M/d/yyyy h:mm:ss tt - n/j/Y g:i:s a - (AM='AM' PM ='PM')
Afrikaans - af - yyyy/MM/dd hh:mm:ss tt - Y/m/d h:i:s a - (AM='VM.' PM ='NM.')
foreach (System.Globalization.CultureInfo ci in ResourceManager.SupportedCultures)
{
if (ci.DateTimeFormat.LongTimePattern.Contains("tt"))
{
var format = string.Format("{0} {1}", ci.DateTimeFormat.ShortDatePattern, ci.DateTimeFormat.LongTimePattern);
var phpFormat = Ext.Net.Utilities.DateTimeUtils.ConvertNetToPHP(format);
System.Diagnostics.Debug.WriteLine(string.Format("{0} - {1} - {2} - {3} - (AM='{4}' PM ='{5}')", ci.EnglishName, ci.ToString(), format, phpFormat, ci.DateTimeFormat.AMDesignator, ci.DateTimeFormat.PMDesignator));
}
}
Outputs:Afrikaans - af - yyyy/MM/dd hh:mm:ss tt - Y/m/d h:i:s a - (AM='VM.' PM ='NM.')
Greek (Greece) - el-GR - d/M/yyyy h:mm:ss tt - j/n/Y g:i:s a - (AM='πμ' PM ='μμ')
English - en - M/d/yyyy h:mm:ss tt - n/j/Y g:i:s a - (AM='AM' PM ='PM')
English (Australia) - en-AU - d/MM/yyyy h:mm:ss tt - j/m/Y g:i:s a - (AM='AM' PM ='PM')
Persian - fa - dd/MM/yyyy hh:mm:ss tt - d/m/Y h:i:s a - (AM='ق.ظ' PM ='ب.ظ')
Korean - ko - yyyy-MM-dd tt h:mm:ss - Y-m-d a g:i:s - (AM='오ì*„' PM ='오후')
Vietnamese - vi - dd/MM/yyyy h:mm:ss tt - d/m/Y g:i:s a - (AM='SA' PM ='CH')
Chinese (Traditional, Taiwan) - zh-TW - yyyy/M/d tt hh:mm:ss - Y/n/j a h:i:s - (AM='上åˆ' PM ='下åˆ')
Note: On ext-locale-zh-TW the attributes Ext.Date.formatCodes.a, Ext.Date.formatCodes.A, Ext.Date.parseCodes.a and Ext.Date.parseCodes.A are defined but on ext-locale-af, ext-locale-el-GR, ext-locale-fa, ext-locale-ko and ext-locale-vi those attributes are not defined.Parsing a date using Ext.Date.parse works on English, English (Australia) and Chinese (Traditional, Taiwan)
English - en - M/d/yyyy h:mm:ss tt - n/j/Y g:i:s a - (AM='AM' PM ='PM')
<!DOCTYPE html>
<html>
<head runat="server">
</head>
<body>
<ext:ResourceManager ScriptMode="Debug" Locale="en" Theme="Crisp" runat="server">
<Listeners>
<DocumentReady Handler="Ext.Msg.alert('Date', Ext.Date.parse('12/28/2015 10:20:30 PM', 'n/j/Y g:i:s a'))" />
</Listeners>
</ext:ResourceManager>
</body>
</html>
English (Australia) - en-AU - d/MM/yyyy h:mm:ss tt - j/m/Y g:i:s a - (AM='AM' PM ='PM')<!DOCTYPE html>
<html>
<head runat="server">
</head>
<body>
<ext:ResourceManager ScriptMode="Debug" Locale="en-AU" Theme="Crisp" runat="server">
<Listeners>
<DocumentReady Handler="Ext.Msg.alert('Date', Ext.Date.parse('28/12/2015 10:20:30 PM', 'j/m/Y g:i:s a'))" />
</Listeners>
</ext:ResourceManager>
</body>
</html>
Chinese (Traditional, Taiwan) - zh-TW - yyyy/M/d tt hh:mm:ss - Y/n/j a h:i:s - (AM='上åˆ' PM ='下åˆ')<!DOCTYPE html>
<html>
<head runat="server">
</head>
<body>
<ext:ResourceManager ScriptMode="Debug" Locale="zh-TW" Theme="Crisp" runat="server">
<Listeners>
<DocumentReady Handler=" Ext.Msg.alert('Date', Ext.Date.parse('2015/12/28 ä¸‹åˆ 10:20:30', 'Y/m/d a h:i:s'))" />
</Listeners>
</ext:ResourceManager>
</body>
</html>
But it doesn't work on Afrikaans, Greek (Greece), Persian, Korean and VietnameseAfrikaans - af - yyyy/MM/dd hh:mm:ss tt - Y/m/d h:i:s a - (AM='VM.' PM ='NM.')
<!DOCTYPE html>
<html>
<head runat="server">
</head>
<body>
<ext:ResourceManager ScriptMode="Debug" Locale="af" Theme="Crisp" runat="server">
<Listeners>
<DocumentReady Handler="Ext.Msg.alert('Date', Ext.Date.parse('2015/12/28 10:20:30 NM.', 'Y/m/d h:i:s a'))" />
</Listeners>
</ext:ResourceManager>
</body>
</html>
Greek (Greece) - el-GR - d/M/yyyy h:mm:ss tt - j/n/Y g:i:s a - (AM='πμ' PM ='μμ')<!DOCTYPE html>
<html>
<head runat="server">
</head>
<body>
<ext:ResourceManager ScriptMode="Debug" Locale="el-GR" Theme="Crisp" runat="server">
<Listeners>
<DocumentReady Handler="Ext.Msg.alert('Date', Ext.Date.parse('28/12/2015 10:20:30 μμ', 'j/n/Y g:i:s a'))" />
</Listeners>
</ext:ResourceManager>
</body>
</html>
Persian - fa - dd/MM/yyyy hh:mm:ss tt - d/m/Y h:i:s a - (AM='ق.ظ' PM ='ب.ظ')<!DOCTYPE html>
<html>
<head runat="server">
</head>
<body>
<ext:ResourceManager ScriptMode="Debug" Locale="fa" Theme="Crisp" runat="server">
<Listeners>
<DocumentReady Handler="Ext.Msg.alert('Date', Ext.Date.parse('28/12/2015 10:20:30 ب.ظ', 'd/m/Y h:i:s a'))" />
</Listeners>
</ext:ResourceManager>
</body>
</html>
Korean - ko - yyyy-MM-dd tt h:mm:ss - Y-m-d a g:i:s - (AM='오ì*„' PM ='오후')<!DOCTYPE html>
<html>
<head runat="server">
</head>
<body>
<ext:ResourceManager ScriptMode="Debug" Locale="ko" Theme="Crisp" runat="server">
<Listeners>
<DocumentReady Handler="Ext.Msg.alert('Date', Ext.Date.parse('2015-12-28 오후 10:20:30', 'Y-m-d a g:i:s'))" />
</Listeners>
</ext:ResourceManager>
</body>
</html>
Vietnamese - vi - dd/MM/yyyy h:mm:ss tt - d/m/Y g:i:s a - (AM='SA' PM ='CH')<!DOCTYPE html>
<html>
<head runat="server">
</head>
<body>
<ext:ResourceManager ScriptMode="Debug" Locale="vi" Theme="Crisp" runat="server">
<Listeners>
<DocumentReady Handler="Ext.Msg.alert('Date', Ext.Date.parse('28/12/2015 10:20:30 CH', 'd/m/Y g:i:s a'))" />
</Listeners>
</ext:ResourceManager>
</body>
</html>
Thanks in advance
Last edited by RaphaelSaldanha; Dec 29, 2015 at 1:05 AM.