Alex Karpus

My feedback

  1. 5 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    2 comments  ·  PowerShell » Other PowerShell  ·  Flag idea as inappropriate…  ·  Admin →
    An error occurred while saving the comment
    Alex Karpus supported this idea  · 
  2. 5 votes
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)

    We’ll send you updates on this idea

    1 comment  ·  PowerShell » Other PowerShell  ·  Flag idea as inappropriate…  ·  Admin →
    Alex Karpus supported this idea  · 
    An error occurred while saving the comment
    Alex Karpus commented  · 

    Here is a repro,

    > Set-Culture "en-GB" # you may have to start a new PS session for culture to take effect
    > ([datetime] "06/08/2018").ToShortDateString() # expecting 06/08/2018
    08/06/2018
    > ("06/08/2018" -as [datetime]).ToShortDateString() # expecting 06/08/2018
    06/08/2018

    For some reason the current culture's format is honored when casting using the -as operator, but not when performing an explicit cast.

Feedback and Knowledge Base