[javascript] Get Locale Short Date Format using javascript

I think this is the best way to do it...

_x000D_
_x000D_
    var date = new Date();

    var options = {
        weekday: "short",
        year: "numeric",
        month: "2-digit",
        day: "numeric"
    };

console.log(
    date.toLocaleDateString("en", options) //en is language option, you may specify..
);
_x000D_
_x000D_
_x000D_

More Options and their examples....

Option          Values          Sample output
----------------------------------------------------
weekday         'narrow'        'M'
                'short'         'Mon'
                'long'          'Monday'

year            '2-digit'       '01'
                'numeric'       '2001'

month           '2-digit'       '01'
                'numeric'       '1'
                'narrow'        'J'
                'short'         'Jan'
                'long'          'January'

day             '2-digit'       '01'
                'numeric'       '1'

hour            '2-digit'       '12 AM'
                'numeric'       '12 AM'

minute          '2-digit'       '0'
                'numeric'       '0'

second          '2-digit'       '0'
                'numeric'       '0'

timeZoneName    'short'         '1/1/2001 GMT+00:00'
                'long'          '1/1/2001 GMT+00:00'