The FormatDate function is output in the time format in javascript. The time format is formatdate.
This example describes how to output the FormatDate function in time format in javascript. Share it with you for your reference. The details are as
This article mainly introduces how to implement the FormatDate function output in the time format in javascript, and how to implement the function of inputting the format of the date and time content like the fmt tag. it is a very practical
This article describes the JavaScript implementation time format output FormatDate function. Share to everyone for your reference. Specifically as follows:
JavaScript does not provide a function to enter the date-time content format as FMT
Today we will focus on the remaining fmt labels.
1. parse numbers
The parseNumber label is opposite to the formatNumber label. formatNumber converts a number to a self-string, while parseNumber converts a string to a number.
Equivalent to the pasre
/** * Convert date to a specified format of string * months (M), Day (d), 12 hours (h), 24 hours (h), minutes (m), seconds (s), Weeks (E), quarter (q) can use 1-2 placeholders * year (y) can use 1-4 placeholders, milliseconds (s) only with A
ObjectiveOriginally wanted to imitate the Java inside of the SimpleDateFormat() object, but feel this use is inconvenient, so or directly write a separate method to forget.Original linkDate formatting usage instructionsFormatDate (date, FMT), where
Recently read some about object-oriented knowledge, in the recent work in the statistical query need to use this month, nearly three months, this year's date range, so the following with the idea of object-oriented to write a get date plug-in, we
Vue converts a timestamp to a custom time format.
1. First create a date. js file and write the following code:
Export function formatDate (date, fmt) {if (/(y + )/. test (fmt) {fmt = fmt. replace (RegExp. $1, (date. getFullYear () + ''). substr (4
For example, you want to implement the function. Input the timestamp "1400000000". Return format: 2015-01-01PHP implementation: date (& quot; Y-m-dH: I: s & quot;, & quot; 1400000000 & quot ;); what about javascript implementation ?? For example,
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.