Advanced ShowDate Function
CSGNetwork FREE Source Code, Javascript Source, and Code Snippets!

 
CSGNetwork
Snippets
Calculators
Home
Back



Right click this window and select "view source" in order to copy the source for this script.

Returns: a date string variable.

Syntax: Showdate ( [date object], [day string], [month string], [date string], [year string], [delimeter string] )

Date Object:- Javascript date object in the form new Date(), new Date(1982,06,30).

day:- Day string in the form "dddd" [full name] or "ddd" [abbreviated].

month:- Month string in the form "mmmm" [full name], "mmm" [abbreviated], "mm" [2 digit], "m" [1 digit].

date:- Date string in the form "dddd" [full name], "ddd" [abbreviated], "dd" [2 digit], "d" [1 digit].

year:- Year string in the form "yyyy" [4 digit], "yy" [2 digit].

delimeter:- Any character to display as separation point in the date display format: eg. ".", "-", "/"

Flexibility of this script allows the user to specify the date format as desired.


Example Results
Showdate(new Date(), 'dddd', 'mmmm', 'dd', 'yyyy', '-')
Showdate(new Date(), 'dd', 'mm', 'dd', 'yyyy', '.')
Showdate(new Date(2001,11,25), 'dddd', 'mmm', 'dd', 'yy', ' ')
Showdate(new Date(2010,11,25), 'yyyy', 'mm', 'dd', '', '')
Showdate(new Date(2000,05 ,25), '', 'mm', 'dd', 'yy', '/')
Showdate(new Date(), '', 'mm', 'dd', 'yyyy', '/')
Showdate(new Date(), '', 'mmm', '', '', '')
Showdate(new Date(), '', 'mmm', '', '', '')