Converting Date from French to Taiwanese

Share |

Subscribe to Feed

PowerShell eBook
Sign up for
Your PowerTip of the Day:

Powershell Plus

13 Free SQL Tools from Idera

Free Ebook: Mastering Powershell


Date and Time formats are highly culture-specific, so often you need to convert date and time from one cultural format to another. That's pretty straight-forward. All you need to know are the culture IDs to convert from and convert to.

This line will list all culture infos so you can easily pick the culture name from the column "Name":

PS> [System.Globalization.CultureInfo]::GetCultures('AllCultures') | Sort-Object DisplayName

And this example takes a French date and returns it in Taiwanese format:

$dateFrench = 'vendredi 23 novembre 2012 11:19:13'

[System.Globalization.CultureInfo]$French = 'fr-FR'
[System.Globalization.CultureInfo]$Taiwan = 'zh-TW'

$DateTime = [datetime]::Parse($dateFrench, $French)

$dateTaiwan = $DateTime.ToString($Taiwan)

Twitter This Tip! ReTweet this Tip!

Posted Jan 31 2013, 06:00 AM by ps1
Copyright 2012 All rights reserved.