views:

30

answers:

2

Been having a poke around and I am trying to be able to get the individual sections of the date chosen by the date picker as vars, so they can be used outside the .datepicker function.

Is there an array I can access to grab this data?

You can format the date as one of the functions options using dateFormat: "dd mm yy" etc, so there must be a way just to set dd as var day mm as var month etc.

+1  A: 

Do you know about the getDate and setDate methods of the datepicker ?

quoting the setDate

The new date may be a Date object or a string in the current date format (e.g. '01/26/2009'), a number of days from today (e.g. +7) or a string of values and periods ('y' for years, 'm' for months, 'w' for weeks, 'd' for days, e.g. '+1m +7d'), or null to clear the selected date.

Gaby
Thanks, ended up using both!
danixd
+1  A: 

We have two steps here:

  1. Fetch selected date: the getDate method "Returns the current date for the datepicker or null if no date has been selected"

  2. Format the date as string: the formatDate utility function "Format a date into a string value with a specified format"

Follow the links for some usage examples.

Álvaro G. Vicario