I work on windows-mobile 6.5
the region is English (United States)
date: M/d/yy
time: h:mm:ss tt
I've this code:
DateTime dt_1,dt_2;
try
{
CultureInfo obj = new CultureInfo("en-US");
dt_1 = DateTime.Parse(TmpD_from, obj);
}
catch
{
CultureInfo obj = new CultureInfo("he-IL");
dt_1 = DateTime.Parse(TmpD_from, obj);
}
try
{
CultureInfo obj = new CultureInfo("en-US");
dt_2 = DateTime.Parse(TmpD_to, obj);
}
catch
{
CultureInfo obj = new CultureInfo("he-IL");
dt_2 = DateTime.Parse(TmpD_to, obj);
}
if (DateTime.Today >= dt_1.Date && DateTime.Today <= dt_2.Date)
{
return true;
}
else
{
return false;
}
the values:
开发者_StackOverflow社区TmpD_to: 31/12/2011 00:00:00
TmpD_from: 31/12/2011 00:00:00
and I got this error: PlatformNotSupportedException
You probably get the Exception because the culture "he-IL" (Hebrew, right?) is not supported by Windows Mobile 6.5. I would suggest trying another culture, whose formatting results are close (or equal) to what you want.
精彩评论