JS Time Processing

Source: Internet
Author: User
Function curenttime () {var now = new date (); var year = now. getfullyear (); // year var month = now. getmonth () + 1; // month var day = now. getdate (); // var HH = now. gethours (); // var Mm = now. getminutes (); // minute var clock = year + "/"; if (month <10) Clock + = "0"; clock + = month + "/"; if (day <10) Clock + = "0"; clock + = day + ""; if (hh <10) Clock + = "0 "; clock + = HH + ":"; if (mm <10) Clock + = '0'; clock + = mm; Return (clock);} function curenttime2 () {var now = new date (); var year = now. getfullyear (); // year var month = now. getmonth () + 1; // month var day = now. getdate (); // var HH = now. gethours (); // var Mm = now. getminutes (); // minute var Ss = now. getseconds (); var clock = year + "/"; if (month <10) Clock + = "0"; clock + = month + "/"; if (day <10) Clock + = "0"; clock + = day + ""; if (hh <10) Clock + = "0 "; clock + = HH + ":"; if (mm <10) Clock + = '0'; clock + = mm + ":"; if (SS <10) clock + = '0'; clock + = SS; Return (clock);} function formate_time (STR) {var time = new date (STR); var year = time. getfullyear (); // year var month = time. getmonth () + 1; // monthly var day = time. getdate (); // day // var HH = time. gethours (); // time // var Mm = time. getminutes (); // minute var clock = year + "/"; if (month <10) Clock + = "0"; clock + = month + "/"; if (day <10) Clock + = "0"; clock + = day; Return (clock);} function formate_time2 (STR) {var time = new date (STR ); vaR year = time. getfullyear (); // year var month = time. getmonth () + 1; // monthly var day = time. getdate (); // daily var HH = time. gethours (); // var Mm = time. getminutes (); // minute var Ss = time. getseconds (); var clock = year + "/"; if (month <10) Clock + = "0"; clock + = month + "/"; if (day <10) Clock + = "0"; clock + = day + ""; if (hh <10) Clock + = "0 "; clock + = HH + ":"; if (mm <10) Clock + = '0'; clock + = mm + ":"; if (SS <10) clock + = '0'; clock + = SS; Return (clock);} function formate_time3 (STR) {var time = new date (STR); var year = time. getfullyear (); // year var month = time. getmonth () + 1; // monthly var day = time. getdate (); // daily var HH = time. gethours (); // var Mm = time. getminutes (); // minute // var Ss = time. getseconds (); var clock = year + "/"; if (month <10) Clock + = "0"; clock + = month + "/"; if (day <10) Clock + = "0"; clock + = day + ""; if (hh <10) Clock + = "0 "; clock + = HH + ":"; if (mm <10) Clock + = '0'; clock + = mm; // clock + = mm + ":"; // If (SS <10) Clock + = '0'; // clock + = SS; Return (clock );}

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.