jquery - How can I extract the year from the datepicker() result in JavaScript? -


i not javascript , have doubt related how correcly pick date field.

so page have input tag take date

<input id="datatrasmissioneade" class="hasdatepicker" type="text" onchange="aggiornamentodateag(this.value)" readonly="readonly" value="" maxlength="10" name="datatrasmissioneade"> 

so input tag contain 25/06/2015 (and have first trivial doubt: content of input tag considered string or date in javascript?)

ok, have javascript function retrieve content of previous input tag by:

odatatrasmissioneade = $("#datatrasmissioneade").datepicker("getdate"); alert("data trasmissione all'ade: " + odatatrasmissioneade); 

the alert() function show this:

data trasmissione all'ade: thu jun 25 2015 00:00:00 gmt+0200 (ora solare europa occidentale)

so think, absolutly not true assertion, input tag having id="datatrasmissioneade" contains string having value 25/06/2015 , datepicker() function convert string related date.

is true or missing something? pure javascript function or jquery function? seems me function in used classi javascript function searching online seems me datepicker() jquery function?

how can extract year value value of odatatrasmissioneade variable (obtained use of datepicker() function) ?

so in previous case have obtain 2015 value.

tnx

try:

odatatrasmissioneade = $("#datatrasmissioneade").datepicker("getdate");  var mydate = new date(odatatrasmissioneade );  alert ( mydate.getfullyear() ); 

you can whatever want later date object.


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

android - CollapsingToolbarLayout: position the ExpandedText programmatically -

Listeners to visualise results of load test in JMeter -