Need a means to configure the culture settings from within PowerShell on Linux
See original GitHub issueSummary of the new feature/enhancement
On my Linux boxes ls -l
does display date and time formats in my preferred way (yyyy-MM-dd HH:mm
):
PS❯ ls -l /tmp/foo
-rw-rw-r-- 1 sto sto 4 Aug 12 1995 /tmp/foo
PS❯ ls -l /tmp/foo --full-time
-rw-rw-r-- 1 sto sto 4 1995-08-12 23:59:59.000000000 +0200 /tmp/foo
PS❯ touch /tmp/bar
PS❯ ls -l /tmp/bar
-rw-rw-r-- 1 sto sto 0 May 8 16:44 /tmp/bar
whereas PowerShell seems to use the locale-imported settings:
PS❯ locale -k LC_TIME
abday="Sun;Mon;Tue;Wed;Thu;Fri;Sat"
day="Sunday;Monday;Tuesday;Wednesday;Thursday;Friday;Saturday"
abmon="Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec"
mon="January;February;March;April;May;June;July;August;September;October;November;December"
am_pm="AM;PM"
d_t_fmt="%a %d %b %Y %r %Z"
d_fmt="%m/%d/%Y"
t_fmt="%r"
t_fmt_ampm="%I:%M:%S %p"
era=
era_year=""
era_d_fmt=""
alt_digits=
era_d_t_fmt=""
era_t_fmt=""
time-era-num-entries=0
time-era-entries="S"
week-ndays=7
week-1stday=19971130
week-1stweek=1
first_weekday=1
first_workday=2
cal_direction=1
timezone=""
date_fmt="%a %d %b %Y %r %Z"
time-codeset="UTF-8"
alt_mon="January;February;March;April;May;June;July;August;September;October;November;December"
ab_alt_mon="Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec"
PS❯ date
Sat 08 May 2021 04:26:03 PM CEST
PS❯ (Get-Culture).DateTimeFormat
AMDesignator : AM
Calendar : System.Globalization.GregorianCalendar
DateSeparator : /
FirstDayOfWeek : Sunday
CalendarWeekRule : FirstDay
FullDateTimePattern : dddd, MMMM d, yyyy h:mm:ss tt
LongDatePattern : dddd, MMMM d, yyyy
LongTimePattern : h:mm:ss tt
MonthDayPattern : MMMM d
PMDesignator : PM
RFC1123Pattern : ddd, dd MMM yyyy HH':'mm':'ss 'GMT'
ShortDatePattern : M/d/yyyy
ShortTimePattern : h:mm tt
SortableDateTimePattern : yyyy'-'MM'-'dd'T'HH':'mm':'ss
TimeSeparator : :
UniversalSortableDateTimePattern : yyyy'-'MM'-'dd HH':'mm':'ss'Z'
YearMonthPattern : MMMM yyyy
AbbreviatedDayNames : {Sun, Mon, Tue, Wed…}
ShortestDayNames : {S, M, T, W…}
DayNames : {Sunday, Monday, Tuesday, Wednesday…}
AbbreviatedMonthNames : {Jan, Feb, Mar, Apr…}
MonthNames : {January, February, March, April…}
IsReadOnly : True
NativeCalendarName : Gregorian Calendar
AbbreviatedMonthGenitiveNames : {Jan, Feb, Mar, Apr…}
MonthGenitiveNames : {January, February, March, April…}
PS❯ gi /tmp/foo
Directory: /tmp
Mode LastWriteTime Length Name
---- ------------- ------ ----
----- 8/12/1995 11:59 PM 4 [ foo
PS❯ gi /tmp/bar
Directory: /tmp
Mode LastWriteTime Length Name
---- ------------- ------ ----
----- 5/8/2021 4:44 PM 0 [ bar
We need a way to define the culture settings within PowerShell, independently from the Linux-level locale settings.
Even something that sets those settings in a volatile way from the profile would be a first step.
This is probably related to https://github.com/PowerShell/PowerShell/issues/3833
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Get-Culture (Microsoft.PowerShell.Utility)
The first command uses the Get-Culture cmdlet to get the current culture settings on the computer. It stores the resulting culture object in...
Read more >How to set culture in PowerShell?
For WinServer2012 and Win8 you can use Set-Culture . As Set-Culture sets the culture for your user, you'd have to open another powershell...
Read more >Use Culture Information in PowerShell to Format Dates
Hello KL,. Microsoft Scripting Guy Ed Wilson here. The technique that allows for automatic conversion of date types is called culture settings.
Read more >Set language, culture and timezone using PowerShell
I've seen the cmdlets introduced in Windows 8 and Windows 2012 that allow you to set the language, culture and timezone but these...
Read more >How to change the date format locale for powershell?
I am using windows with WSL Ubuntu. On Windows, when I do the `ls` command it prints the date in the corrent format...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Please unsubscribe me from powershell as I am an elderly woman and GitHub does not interest me. Regards from Raylee Heading
This issue has been marked as answered and has not had any activity for 1 day. It has been closed for housekeeping purposes.