Been having a poke around and I am trying to be able to get the individual sections of the date chosen by the date pic开发者_Go百科ker 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.
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.
We have two steps here:
Fetch selected date: the getDate method "Returns the current date for the datepicker or null if no date has been selected"
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.
精彩评论