Sorting/re-arranging files by US/UK LastWriteTime
<p>I have a directory of files with the similar filenames in Windows, and the Date Modified are in UK date format <code>dd/mm/yyyy</code>, and all I need to do is select the "-last 1" based on the <code>dd</code> and <code>mm</code>. In this case, it's a file with a Windows Date Modified date of "07/12/16" or "7th Dec 2016". There is also another file in the same directory with a UK date "01/12/16", or "1st Dec 2016" for reference. There are lots of other files there too.</p>

<p>However, when running <code>gci "&lt;path&gt;" | Select -last 1</code> on the directory, it returns "12/01/16" instead of "12/07/16", so it's assuming the first part of the date is in US (mm) and sorting by that. Selecting the -first 1 doesn't help as this will select the earliest file in August, "16/08/2016" which is interpreted as "16/08/16".</p>

<p>How can I manipulate the <code>LastWriteTime</code> to read out in the format I want it to be in? I have tried</p>

<pre><code>gci "\\my-Path\.csv" | Select Name, {$_.LastWriteTime.ToString("dd/mm/yyyy")} 
</code></pre>

<p>but this brings back something weird ("07/38/2016")</p>