PS C:\> $a = '103903/06/2006','104803/06/2006','102103-01-2006','112203-06-2007','122304-08-2006','112204-12-2007' PS C:\> $a 103903/06/2006 104803/06/2006 102103-01-2006 112203-06-2007 122304-08-2006 112204-12-2007 |
PS C:\> $a | Sort-Object { [datetime]$_.substring(5) } 102103-01-2006 103903/06/2006 104803/06/2006 122304-08-2006 112203-06-2007 112204-12-2007 |
PS C:\> [datetime]'2006年3月1日' 2006年3月1日 0:00:00 |
PS C:\> $a | sort { [int]$_.substring(2,2) - $_.substring(0,2) } 112203-06-2007 122304-08-2006 112204-12-2007 102103-01-2006 103903/06/2006 104803/06/2006 |
PS C:\> $a | sort {$_.substring(0,2)}, { [datetime]$_.substring(5) }, { [int]$_.substring(2,2) - $_.substring(0,2) } 102103-01-2006 103903/06/2006 104803/06/2006 112203-06-2007 112204-12-2007 122304-08-2006 |
欢迎光临 批处理之家 (http://bbs.bathome.net/) | Powered by Discuz! 7.2 |