Javascript - Get "Monday" from "mon" or "Tuesday" from "tue", etc -


is there correct way go grabbing name of day, when have short version, such following:

mon tue wed thu fri sat sun 

i don't need actualy "date" or time or anything, need string full date name.

a simple associative array (read object) dictionary suffice:

var days = {   'mon': 'monday',   'tue': 'tuesday',   'wed': 'wednesday',   'thu': 'thursday',   'fri': 'friday',    'sat': 'saturday',   'sun': 'sunday' } 

now, can access them follows:

var day  = 'mon',     full = days[day]; // full === 'monday'; 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -