
本文共 2799 字,大约阅读时间需要 9 分钟。
������������ JavaScript ���������������������������������������
������������������������������������������������������������������������������������������������������������������������������������������������
������������������
������������������������������������������������������������������ YYYY-MM-DD ������������������������������������������������
function getNowFormatDate() { var date = new Date(); var year = date.getFullYear(); var month = date.getMonth() + 1; //���������������������1-12 var strDate = date.getDate(); //������������������ if(month >= 1 && month <=9) { month = "0" + month; } //������������������ if(strDate >= 10) { strDate = strDate; } else { strDate = "0" + strDate; } return year + "-" + month + "-" + strDate;}
������������������
���������������������������������������������������������������������������������������������������������������������������������
function compareDate(date1, date2) { var date1 = new Date(date1); var date2 = new Date(date2); return date1.getTime() > date2.getTime();}
������������
������������������������������������������������������
getNowFormatDate()
������compareDate()
������������������������������������������������
��������������������� ������������������
// ������������������ function getNowFormatDate() { var date = new Date(); var year = date.getFullYear(); var month = date.getMonth() + 1; var strDate = date.getDate(); if(month >= 1 & month <=9) { month = "0" + month; } if(strDate >= 0 & strDate <=9) { strDate = "0" + strDate; } return year + "-" + month + "-" + strDate; }
������������������
// ������������������ function compareDate(date1, date2) { var date1 = new Date(date1); var date2 = new Date(date2); return date1.getTime() > date2.getTime(); }
��������������������������������������������������������������������������������������������������������������� `getNowFormatDate()` ������������������������������������������������ YYYY-MM-DD��������� `compareDate()` ���������������������������������������������������
������
- ������������������ JavaScript ������������������������������������������������������
- ���������������������������������������������������������
- ��������� ����������� ������ �������� developer��������������� cupcakes pages ������������������
发表评论
最新留言
关于作者
