I get some issues with code in citates created by indent, for example:
issue on date in code
> For example to cast a date string "08-12-2012" that’s in UK format:
>
> PS C:\> [DateTime]::ParseExact("08-12-2012","dd-MM-yyyy",[System.Globalization.CultureInfo]::InvariantCulture)
> Saturday, December 08, 2012 00:00:00
>
> Cast a date string "09-Jun-2012" that’s in UK format and then display it as "yyyy-MM-dd"
>
> PS C:\> [DateTime]::ParseExact("09-Jun-2012","dd-MMM-yyyy",[System.Globalization.CultureInfo]::InvariantCulture).ToString("yyyy-MM-dd")
> 2012-06-09
issue on converting code in citate
> If you are going to cast a variable into a new datatype it is a good idea to first test if the value will cast sucessfully using -as, if the conversion fails, it will return a NULL, which can be used to either avoid the conversion or to raise an error:
>
> [string]$var = "64a"
> if( ($var -as [double]) -ne $null ) {
> [double]$var = $var
> }
> $var.GetType().FullName
I get some issues with code in citates created by indent, for example: