Search code examples
windowsdatecmddate-format

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.


Solution

  • 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.