Get system Current time (MultiLanguage Version)

Source: Internet
Author: User
Tags dateformat

1. Java Gets the current time
1 //Import2 Importjava.util.Date;3 ImportJava.text.DateFormat;4 ImportJava.text.SimpleDateFormat; 5   6 7Date dt=NewDate ();//If no format is required, the current system time can be used directly with Dt,dt8DateFormat DF =NewSimpleDateFormat ("Yyyy/mm/dd HH:mm:ss");//Set display format9String nowtime= "";TenNowtime= df.format (DT);//obtained in DT using the DateFormat format () method and displayed in YYYY/MM/DD HH:mm:ss format
View Code

Reference: http://www.cnblogs.com/Derek_nr/archive/2009/05/24/1487980.html

2. C # get the current time
1 DateTime now=datetime.now; 2 get the current month 3 Now . Month45 or:67 DateTime.Now.ToString ("  Yyyy-mm-dd");
View Code

More needs can be seen here (many people reprint): http://www.cnblogs.com/huanglong/archive/2012/03/26/2417487.html

3. PHP Gets the current time
1 Echo Date(' y-m-d ');//output Result: 2012-03-222 3 Echo  Date(' y-m-d h:i:s ');//output Result: 2012-03-22 23:00:004 5 Echo  Date(' y-m-d ', Time());//output: 2012-03-22 23:00:00 (same result as above, just one more timestamp parameter) (method of timestamp conversion to date format)6 7 Echo  Date(' Y '). ' Years '.Date(' m '). ' Months '.Date(' d '). ' Day ';//output Result: March 22, 2012
View Code

Reference: http://www.cnblogs.com/MichaelZhangX/archive/2012/07/24/2607503.html

4. JavaScript gets the current time
1 varMyDate =NewDate ();2Mydate.getyear ();//get Current year (2-bit)3Mydate.getfullyear ();//Get the full year (4-bit, 1970-????)4Mydate.getmonth ();//Get the current month (0-11, 0 for January)5Mydate.getdate ();//get current day (1-31)6Mydate.getday ();//get Current week x (0-6, 0 for Sunday)7Mydate.gettime ();//Gets the current time (the number of milliseconds since 1970.1.1)8Mydate.gethours ();//gets the current number of hours (0-23)9Mydate.getminutes ();//gets the current number of minutes (0-59)TenMydate.getseconds ();//gets the current number of seconds (0-59) OneMydate.getmilliseconds ();//gets the current number of milliseconds (0-999) AMydate.tolocaledatestring ();//Get Current date - varMytime=mydate.tolocaletimestring ();//Get current Time -Mydate.tolocalestring ();//get date and time
View Code

Reference: http://www.cnblogs.com/kop-elan/archive/2012/05/15/2501727.html

Get system Current time (MultiLanguage Version)

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.