Simple pic of code for JavaScript
<script type="text/javascript">
$(document).ready(function () {
var curr = new Date; // get current date
var first = curr.getDate() - curr.getDay(); // First day is the day of the month - the day of the week
var last = first + 6; // last day is the first day + 6
var firstday = new Date(curr.setDate(first)).toUTCString();
var lastday = new Date(curr.setDate(last)).toUTCString();
$('#startDate').datebox('setValue', firstday); // I use Easyui Thatswhy my code is different :)
});
</script>
and also u can do some formation by like bellow :
var fdate = firstday.getMonth()+1 + "/" + firstday.getDate() + "/" + firstday.getFullYear();
<script type="text/javascript">
$(document).ready(function () {
var curr = new Date; // get current date
var first = curr.getDate() - curr.getDay(); // First day is the day of the month - the day of the week
var last = first + 6; // last day is the first day + 6
var firstday = new Date(curr.setDate(first)).toUTCString();
var lastday = new Date(curr.setDate(last)).toUTCString();
$('#startDate').datebox('setValue', firstday); // I use Easyui Thatswhy my code is different :)
});
</script>
and also u can do some formation by like bellow :
var fdate = firstday.getMonth()+1 + "/" + firstday.getDate() + "/" + firstday.getFullYear();

0 comments:
Post a Comment