Jul 08, 2013 · Let’s call it with a date string in an uncommon format and see how the function handles different date and time separators: Convert-DateString -Date '12/10\2013 13:26-34' -Format 'dd/MM\\yyyy HH:mm-ss' Saturday, October 12, 2013 1:26:34 PM The function successfully converts the date and returns a DateTime object. If the operation was not ... I've created a Powershell script which is intended to be a clone of the TreeSize tool. It generates a size report of files and folders in a filesystem, presented as an interactive HTML file. I've also created an Agent procedure which can be used to schedule this report and upload to the Agent's file store.
Mar 25, 2009 · $strLastSet = [String]::Format($lastSetDate) $dateLastSet = [datetime]::Parse($strLastSet) $dateExpires = $dateLastSet.AddDays(90) $msg = new-object Net.Mail.MailMessage $msg.From = "[email protected]" $msg.To.Add($ExpiringUserMail) $msg.To.Add("[email protected]") $msg.Subject = $strSubject It will also capture the date fields and the time. Dates are in the YYYY/MM/DD format and validated for months, number of days in a month and leap years (29/2) Date field can be separated by matched periods(.), dashes(-) or forward slashes(/) Time is either 12 hour AM/PM format (hh:mm:ss AM), where minutes and seconds are optional.