I have the below code which gets the earliest date from a selection of date in the format of yyyy-mm-dd, alongside a message. I need to use the date that's been returned to populate my message by way of a declare statement using If and Else I think. For my first yyyy value if the month is less than 8 (August), then I need to use yyyy-1 from my original above mentioned selection, and if its a month greater than 8 (August), then I need to use the returned yyyy from my original selection. I then need this first value to then have / followed by a 2nd year returned, which will be plus 1 year to the first yyyy value. I am using Powershell, so something in .net would be really handy.
$dt = New-Object System.Data.DataTable;
$dt.Columns.Add("LearnStartDate");
$dt.Columns.Add("Message");
$dr = $DS.Tables["LearningDelivery"].Select("LearnStartDate =
min(LearnStartDate)")[0];
Write-Output $dt.Rows.Count;
$dt.Rows.Add($dr["LearnStartDate"].Substring(0,10),"Our message");