JS Gets the current date, the current date, and the last n days of the standard month dayDay=0 is the current day, Day=7 is the first 7 days, Day=-7 is the last 7 days of the current datefunction Getstartdate (day) {var begindate;var curr_time = new Date ();var week_time = new Date (Curr_time.gettime ()-+ + *);var curyear = Week_time.getfullyear ();var curmonth = week_time.getmonth () + 1;Curmonth = curmonth > 9? Curmonth.tostring (): ' 0 ' + curmonth.tostring ();var curday = Week_time.getdate (
1. String conversion to dateDate.parse ()You can convert the string returned by date.tostring () and date.toutcstring () to a date type2. The Date object is converted to the specified format string (simulates the Java API, using a consistent format)Date.prototype.Format=function(FMT){//Author:meizzvaro={"m+": This. GetMonth ()+1,//Month"d+": This. GetDate (),//Day"H +": This. GetHours (),//hours"m+": This. getminutes (),//points"s+": This. getseconds (),//seconds"q+": Math.floor (( This. GetMont
This article is mainly about the use of JavaScript to format the string date to YYYY-MM-DD, the following words are not more, refer to the following code
function FormatDate (date) {
var d = new Date (date),
month = ' + (d.getmonth () + 1), Day
= ' + d.getdate (),
year = D.getfullyear ();
if (Month.length
How to use:
Console.log (For
Common SQL time Format the default date field for the Chinese version of SQL Server datetime format is yyyy-mm-DD Thh:mm:ss.mmm For example:Selectgetdate ()2004- the- A One: .:08.177This is used to transfer data between databases or to be accustomed to the Oracle date forma
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.