views:

43

answers:

0

My application server is in London so date format is freeze to format DD-MMM-YYYY (e.g. today’s date 16-Feb-2010) we have written VBScript code to enter the date in same format. But code fails in LN machine due to LN PC date format is dd/MM/yyyy whether NY and India PC format is MM/dd/yyyy where code works fine.

Here I want one generic function where I can pass argument as date format and it returns the system date in same format.

e.g.

Call MyDateFormat(dd-MM-YYYY) will return me “16-02-2010”

Call MyDateFormat(MM/dd/YYYY) will return me “02/16/2010”

Call MyDateFormat(M/dd/YYYY) will return me “2/16/2010”

Call MyDateFormat(d/M/YYYY) will return me “16/2/2010”

Call MyDeFormat(dd/MMM-YYYY) will return me “16/Feb-2010”

Call MyDateFormat(dd/MMMM_YYYY) will return me “16/February_2010”

Note: The function should not be specific to my requirement it should help everyone where someone want use date in specific format.

Please suggest your solution to get date in any format. If you already have, any then please share.