Use this method
long time = Date.parse("Sun Feb 26 10:31:58 +0800 2012"); SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); Date d = new Date(time); System.out.println(sdf.format(d));
Us time format
// G era flag text ad//
Time currenttime;Currenttime. hometime ();Tbuf time;Currenttime. formatl (time, _ L ("% Y _ % m _ % d _ % H _ % T _ % S _ % C"); // ___ 18_13_37_474750Log (time );Currenttime. formatl (time, _ L ("% Y % m % d % H % T % S % C"); // 181337474750Log
Generally, the format of a date object obtained from the server (such as C # Code) may be 2014-04-04T13: 04: 46.187. When displaying the date object to the user, you may only need to display the date part, for example: many articles on JavaScript
1. Date Format Method for binding: 2. How to format data items such as DataGrid and datalist:E. Item. Cell [0]. Text = convert. todatetime (E. Item. Cell [0]. Text). to1_datestring ();3. Convert the date display format with the string type:String.
Method One: Convert.todatetime (String)
String format is required and must be YYYY-MM-DD HH:MM:SS
================================================
Method Two: Convert.todatetime (String, IFormatProvider)
DateTime DT;
DateTimeFormatInfo Dtformat =
Many times, we can use the built-in methods of the Date object in JavaScript to format it, such as:
Copy Code code as follows:
var d = new Date ();
Console.log (d); Output: Mon Nov 2013 21:50:33 gmt+0800 (China Standard Time)
In Javaweb application, the date returned through the AJAX query is similar to the following "2010-08-01 18:22:00.0", how to according to the hope of the results show that often cost some trouble, here provide two methods to solve this problem, for
@Echo Off
Set _date=%date%
If "%_date%a" LSS "A" (set _numtok=1-3) Else (set _numtok=2-4)
:: Default Delimiter of TAB and Space are used
for/f "tokens=2*"%%a in (' REG QUERY ' HKCU\Control panel\international "/V iDate ') do Set _idate=%%b
for/f
The javascript date Formatting Function of meizz is very useful.
Original post see: http://blog.csdn.net/meizz/article/details/405708
Date.prototype.format = function(format) //author: meizz{ var o = { "M+" : this.getMonth()+1, //month "d+" :
1
I 've posted some of the articles I 've used to write code recently. I 'd like to thank those elders for some good methods.
2
3
%
4
'
========================================================== ====
5
'
Formatting
Author: myssh
-- Use of style when converting character to date
-- 1. When style = 101, the date string is in mm/DD/YYYY format.Select convert (datetime, '2014/1/123', 11/1)-- Result: 00:00:00. 000
-- 2. When style = 101, the
Public class datetime{Public datetime (){}/*** The date and time of the year are used.* @ Return string returns yyyy-mm-dd hh: mm: Ss.*/Public static string getdate (){Simpledateformat formatter_f = new simpledateformat ("yyyy-mm-dd hh: mm: SS
Getting the current datetime and formatted date time in Smarty is a bit different from PHP, here's a detailed description:
The first is to get the current date time:In PHP we will use the DATE function to get the current time, the instance code is
The first: is to convert the time generated in JSON format to the format of the time to see clearlyfunction (Cellval) {var date = new Date (parseint ("Cellval.replace" ("/date", "" "). Replace (")/"," "), 10));var month = Date.getmonth () + 1 var
Under Linux, a simple word: Date ' +%y%m%d-%h%m%s ' can get the output you want: 20120331-064219 but under windows, it's going to take a little bit of work. It's annoying to talk about the output of a date string. Under Linux, a simple word:
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.