Hello. I need to get the differens between two when choosing from a picker. This is my code:
var pickValue = 0; picker.addEventListener('change',function(e) { pickValue = new Date(e.value); pickValueMonth = pickValue.getMonth()+1; pickValue = pickValue.getHours()+":"+pickValue.getMinutes()+" - "+pickValue.getDate()+" "+monthNames[pickValueMonth]; });An example for this would be something like this:
var dateDifferens = (((pickValue.getTime()-xxxValue.getTime())/1000)/3600)/24;But because im using a picker i only have one variable ... PLS help! :) I have already looked in date.js ...
2 Answers
To get picker work on both platforms, do this:
picker.addEventListener('change', function(e) { this.value = e.value; }); picker.getValue = function() { return this.value; };
To get date difference (and "picker.getValue" will return "Date" instance), use minus operator:
var dateDiff = picker2.getValue() - picker1.getValue();
Someone? Maybe little help with some code? I'm really stuck here ...
Your Answer
Think you can help? Login to answer this question!