Get-Culture

Get information about regional settings e.g. current language and keyboard layout.

Syntax
      Get-Culture [CommonParameters]
key

   CommonParameters:
       -Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable,
       -OutBuffer -OutVariable.

Example

This demonstrates drilling down and displaying the properties and sub-properties of the object.

PS C:\> $c = get-culture
PS C:\> $c | format-list -property *
PS C:\> $c.calendar
PS C:\> $c.datetimeformat
PS C:\> $c.datetimeformat.firstdayofweek

Properties available:

Parent                         
LCID                           
KeyboardLayoutId               
Name                           
IetfLanguageTag                
DisplayName                    
NativeName                     
EnglishName                    
TwoLetterISOLanguageName       
ThreeLetterISOLanguageName     
ThreeLetterWindowsLanguageName 
CompareInfo                    
TextInfo                       
IsNeutralCulture               
CultureTypes                   
NumberFormat                   
DateTimeFormat                 
Calendar                       
OptionalCalendars              
UseUserOverride                
IsReadOnly                     
MinSupportedDateTime 
MaxSupportedDateTime 
AlgorithmType        
CalendarType         
Eras                 
TwoDigitYearMax      
IsReadOnly           
AMDesignator                     
Calendar                         
DateSeparator                    
FirstDayOfWeek                   
CalendarWeekRule                 
FullDateTimePattern              
LongDatePattern                  
LongTimePattern                  
MonthDayPattern                  
PMDesignator                     
RFC1123Pattern                   
ShortDatePattern                 
ShortTimePattern                 
SortableDateTimePattern          
TimeSeparator                    
UniversalSortableDateTimePattern 
YearMonthPattern                 
AbbreviatedDayNames              
ShortestDayNames                 
DayNames                         
AbbreviatedMonthNames            
MonthNames                       
IsReadOnly                       
NativeCalendarName               
AbbreviatedMonthGenitiveNames    
MonthGenitiveNames

Return type:
System.Globalization.CultureInfo object

Example

Title-case a string so that each word starts with an uppercase letter:

PS C:\> $string = "this is a word or sentence"
PS C:\> $textInfo = (Get-Culture).TextInfo

PS C:\> $textInfo.ToTitleCase($string)
This Is A Word Or Sentence

“The eternally incomprehensible thing about the world is that it is comprehensible” ~ Albert Einstein

Related PowerShell Commands:

Get-UICulture - Get ui culture information.
ToLower() and ToUpper() methods.


Copyright © SS64.com 1999-2019
Some rights reserved