How to change the display format for datepicker

Hi All,

May I know how to change the datepicker display format from “2011.07.27” to “07/2011”?

	{ view: 'datepicker', label: 'Date Month', labelWidth: '105', date: new Date(), startOnMonday: true, navigation: true, skipEmptyWeeks: true, calendarDateFormat: '%Y-%m-%d', calendarMonthHeader: '%F %Y', calendarDayHeader: '%d', calendarWeek: '%W', cellAutoHeight: true, id: 'SA_cboDate'}

Thanks!

Regards,
winston.

Hello,

There are two options to do it:

  1. Set global dateFormat setting:

dhx.i18n.dateFormat = "%m/%Y"; dhx.i18n.setLocale();
2. Set datepicker specific option (have priority over global setting):

{ view: 'datepicker', label: 'Date Month', dateFormat: '%m/%Y', ...

Best regards,
Ilya

Hi,

I post the form and try to get the value of the datepicker, it always return this value date : Fri Jul 29 2011 20:30:37 GMT+0800 (Malay Peninsula Standard Time)

I am using VB CDate() function to convert this string to date but failed. May I know how I can get the proper display date string e.g. 29-07-2011?

Thanks!

Regards,
winston.

If you are taking value from the form by getValues - it will return javascript date object ( which will be auto-converted to string during data sending - using native js date format )

you can use something like next to receive string value as string

var data = dhx.i18n.fullDateFormatStr($$(‘SA_cboDate’).getValue());

it will be date in “%d-%m-%Y %H:%i” format

Hi Stanislav,

Thanks for the quick response. I would like to post the date value of the datepicker to another ASP page for processing using AJAX, may I know how I can add a hidden field in the form, so that when the user select a date, I set the date value to this hidden field and post to the ASP page in parse-able format.

Thanks!

Regards,
winston.

Current version of form supports only data sending by ajax, in which case you can use

var data = $$('form').getValues(); data.formatted_date = dhx.i18n.fullDateFormatStr(data.date); dhx.ajax().post("some.asp", data);