i.e. split()
<input type="text" id="tbDateTime" value="2010-10-18 10:06" />
<input type="text" id="tbDate" value="" />
<input type="text" id="tbTime" value="" />
<input type="button" id="btnSubmit" value="Submit" />
<script type="text/javascript">
$(function () {
$('#btnSubmit').click(function () {
var dateTimeSplit = $('#tbDateTime').val().split(' ');
var dateSplit = dateTimeSplit[0].split('-');
//year
alert(dateSplit[2]);
//month
alert(dateSplit[1]);
//day
alert(dateSplit[0]);
});
});
</script>
No comments:
Post a Comment