How to use AngularJS date formatting
This time I will show you how to use AngularJS date formatting, what are the precautions for using AngularJS date formatting, the following is a practical case, let's take a look.
<!DOCTYPE html> <html ng-app="myApp"> <head lang="en"> <meta charset="UTF-8"> <title>AngularJS日期格式化</title> <script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script> <style> .c1 { color: red; } </style> </head> <body ng-controller="myCtrl"> <!--格式 : 年-月-日 星期 时:分:秒.毫秒 --> <p>{{time| date:'yyyy-MM-dd EEE HH:mm:ss.sss'}}</p> <!--2017-01-06 Fri 20:41:58.000--> <p>{{time| date:'yyyy-MM-dd EEEE hh:mm:ss.sss'}}</p> <!--2017-01-06 Friday 08:41:58.000--> <!--EEE:简写英文星期--> <!--EEEE:英文星期--> <!--HH:24小时制--> <!--hh:12小时制--> <p class="c1">本地化日期格式化:</p> <p>{{time| date:'medium'}}</p> <!--Mar 8, 2017 9:26:08 AM--> <p>{{time| date:'short'}}</p> <!--3/8/17 9:26 AM--> <p>{{time| date:'fullDate'}}</p> <!--Wednesday, March 8, 2017--> <p>{{time| date:'longDate'}}</p> <!--March 8, 2017--> <p>{{time| date:'mediumDate'}}</p> <!--Mar 8, 2017--> <p>{{time| date:'shortDate'}}</p> <!--3/8/17--> <p>{{time| date:'mediumTime'}}</p> <!--9:26:08 AM--> <p>{{time| date:'shortTime'}}</p> <!--9:26 AM--> <p class="c1">年份格式化::</p> <p>{{time| date:'yyyy'}}</p> <!--四位年份:2017--> <p>{{time| date:'yy'}}</p> <!--二位年份:17--> <p>{{time| date:'y'}}</p> <!--一位年份:2017--> <p class="c1">月份格式化:</p> <p>{{time| date:'MMMM'}}</p> <!--英文月份:March--> <p>{{time| date:'MMM'}}</p> <!--英文月份简写:Mar--> <p>{{time| date:'MM'}}</p> <!--两位数字月份:03--> <p>{{time| date:'M'}}</p> <!--1年中的第几个月份:3--> <p class="c1">日期格式化:</p> <p>{{time| date:'dd'}}</p> <!--数字日期:08--> <p>{{time| date:'d'}}</p> <!--1个月中的第几天:8--> <p class="c1">星期格式化:</p> <p>{{time| date:'EEEE'}}</p> <!--英文星期:Wednesday--> <p>{{time| date:'EEE'}}</p> <!--英文星期简写:Wed--> <p class="c1">小时格式化:</p> <p>{{time| date:'HH'}}</p> <!--24小时制数字小时:19--> <p>{{time| date:'H'}}</p> <!--1天中的第几个小时:19--> <p>{{time| date:'hh'}}</p> <!--12小时制数字小时:07--> <p>{{time| date:'h'}}</p> <!--上午或下午的第几个小时:7--> <p class="c1">分钟格式化:</p> <p>{{time| date:'m'}}</p> <!--数字分钟数:26--> <p>{{time| date:'mm'}}</p> <!--1个小时中的第几分钟:26--> <p class="c1">秒格式化:</p> <p>{{time| date:'ss'}}</p> <!--数字秒数:08--> <p>{{time| date:'s'}}</p> <!--1分钟中内的第几秒:8--> <p class="c1">毫秒格式化:</p> <p>{{time| date:'sss'}}</p> <!--毫秒数:301--> <p class="c1">字符格式化:</p> <p>{{time| date:'a'}}</p> <p>{{time| date:'Z'}}</p> <!--上下午标识:AM--> <!--四位时区标识:+0800--> <script> var app = angular.module("myApp", []); app.controller("myCtrl", function ($scope) { // $scope.time = new Date(); $scope.time = 1483706518000; }); </script> </body> </html>
Run results:
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!
Recommended reading:
How to deal with Mac installation thrift error due to bison
How to correctly handle Taobao cnpm after installing cnpm is not Internal or external command
The above is the detailed content of How to use AngularJS date formatting. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

DOS command is a command line tool used in Windows operating system, which can be used to perform various system management tasks and operations. One of the common tasks is to format the hard drive, including the C drive. Formatting the C drive is a relatively dangerous operation because it will erase all data on the C drive and reinitialize the file system. Before performing this operation, make sure you have backed up important files and have a clear understanding of the impact that formatting will have on your computer. The following is formatted in the DOS command line

Many times when using a computer, you will encounter too much garbage, but many users still don’t know how to format the computer. It doesn’t matter. Here is a tutorial on computer formatting for you to take a look at. How to format a computer: 1. Right-click "This PC" on the desktop and click "Manage". 2. Click "Storage" in "Computer Management" to open "Disk Management". 3. Select the hard drive you want to clean, right-click and select "Format". 4. Check "Perform Quick Format" and click "OK" to start formatting.

Will formatting a laptop make it faster? If you want to format your Windows laptop but want to know if it will make it faster, this article will help you know the right answer to this question. Will formatting a laptop make it faster? There are many reasons why users format their Windows laptops. But the most common reason is slow performance or speed of your laptop. Formatting a laptop will completely delete all data stored on the C drive or the hard drive partition where Windows operating system is installed. Therefore, every user will think twice before taking this step, especially when it comes to the performance of the laptop. This article will help you understand whether formatting your laptop will speed it up. Formatting your laptop helps

Nowadays, we will inevitably encounter some problems such as being unable to turn on the phone or lagging, such as system crash, but during use, mobile phones have become an indispensable part of our lives. We are often at a loss, and sometimes, there are no solutions to these problems. To help you solve cell phone problems, this article will introduce you to some methods of cell phone format recovery and restore your phone to normal operation. Back up data - protect important information, such as photos and contacts, from being lost during the formatting process. Before formatting your phone, the first thing to consider is to back up important data and files on your phone. To ensure data security, or choose to transfer files to a cloud storage service, you can back it up by connecting to a computer. Use the system's built-in recovery function - simple

How to solve 0x80070057 error: simple and effective methods and steps Introduction: In the process of using the computer, we sometimes encounter various error codes. Among them, 0x80070057 is a very common error code, which is usually related to Windows operating system. This error code can appear in different situations, such as when installing or updating the operating system, backing up or restoring files, formatting drives, etc. Although this error code is frustrating, it's not unsolvable. This article will introduce

HTML formatting method: 1. Use online HTML formatting tools; 2. Use the HTML formatting shortcut keys that come with the code editor, such as Shift + Alt + F in Visual Studio Code; 3. Use plug-ins, such as Sublime Text HTML/CSS/JS Prettify plug-in; 4. Use command line tools, such as HTML Tidy; 5. Manual formatting according to coding standards and habits.

JavaScript tutorial: How to get HTTP status code, specific code examples are required. Preface: In web development, data interaction with the server is often involved. When communicating with the server, we often need to obtain the returned HTTP status code to determine whether the operation is successful, and perform corresponding processing based on different status codes. This article will teach you how to use JavaScript to obtain HTTP status codes and provide some practical code examples. Using XMLHttpRequest

Eclipse is a very popular Java integrated development environment (IntegratedDevelopmentEnvironment, IDE). It provides many functions and shortcut keys to facilitate developers to improve efficiency. One of the commonly used functions is code formatting. This article will introduce the formatting shortcut key in Eclipse and how to use it. In Eclipse, code formatting is a very important operation. By formatting your code, you can make it
