|
Chaim6
2014-01-30 09:26:44
|
|
How do you add the last day of the month to a date field of a csv which only includes Year and Month?
I'm trying to modify the C# Pre Script in the Morningstar downloader. Currently the Morningstar downloader just adds a 1 for the day of month, possibly because that was simpler and good enough for the one who wrote it. I am trying to modify it to more accurately default to the last day of the month. Here is what I tried:
...
if (System.DateTime.TryParseExact(Content.Rows[2].Data[i],"yyyy-MM", CultureInfo.InvariantCulture, DateTimeStyles.None, dtDate)) { // The Morningstar csv date fields are formatted as yyyy-MM without the day of month
// Code to add DateTime.DaysInMonth(...)-1 and convert it back to a string goes here
}
But the compiler gave the error messages: The name 'CultureInfo' does not exist in the current context. The name 'DateTimeStyles' does not exist in the current context. Apparently there must be some way of adding a reference to them. How do I get this to work?
Thanks.
|
|