Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows command that will return the short date format of the OS

I need a command (CMD) that will return the date format set for current user or system wide. We can change the default format or in different regions it's different format set by default so I need to find the format currently OS is using.

Main problem is I can't schedule tasks because i'm missing the date format when trying to schedule tasks.

enter image description here

so I need the date format not the actual date value :)

note: I saw some ways with power shell but on windows 8 and windows server 2008 power shell is not by default enabled.

like image 842
Emrah Mehmedov Avatar asked Dec 21 '25 21:12

Emrah Mehmedov


1 Answers

The short date format can be retrieved from the registry.

>reg query "HKEY_USERS\.DEFAULT\Control Panel\International" /v sShortDate

HKEY_USERS\.DEFAULT\Control Panel\International
    sShortDate    REG_SZ    M/d/yyyy

And, for the current user:

>reg query "HKEY_CURRENT_USER\Control Panel\International" /v sShortDate

HKEY_CURRENT_USER\Control Panel\International
    sShortDate    REG_SZ    yyyy-MM-dd

PowerShell is clearly the direction Microsoft has set. Perhaps it would be a good idea to enable it and learn it.

like image 137
lit Avatar answered Dec 23 '25 12:12

lit



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!