Does string comparison in date format not work?

Hi, for some reason, I can’t compare the strings to a date? Take for example:

public List<HireDate> GetHireDate(string anything)
{
List<HireDate> hiredate = hiredates.Where(n =>
string.Equals(n.HireFromDate, anything, StringComparison.CurrentCultureIgnoreCase)
).ToList();
return hiredate;
}

Does it just not work? if I type a text field 13/07/2012, that is, how it stores it, it returns 404, not found.

The result is as follows from a general query / query:

<ArrayOfHireDate>
<HireDate>
<HireFromDate>13/07/2012</HireFromDate>
<HireToDate>28/07/2012</HireToDate>
<NumberOfDaysHired>15</NumberOfDaysHired>
</HireDate>
</ArrayOfHireDate>

Is there any other way to find a slash string? For example, using / in any of the network mappings does not work, will it always call 404 not found?

0
source share
1 answer

Two things:

1) , - String.Format. (, "Date: {0} Time: {1}") . {0} , {1} .. , . MSDN String.Format.

2) URL-, 404 , URL-. URL-, , , , , . , , 13-07-2012 13/07/2012 . , , , , CultureInfo.

DateTime date , CultureInfo, , ToString d . , :

var str = date.ToString("d", CultureInfo.InvariantCulture);

.

+1

All Articles