# lqqtimeformat-tools

> npm install lqqtimeformat-tools

Latest version **1.0.2** (published 2022-10-11) · ISC license · 0 weekly downloads

## Install

```sh
npm install lqqtimeformat-tools
pnpm add lqqtimeformat-tools
yarn add lqqtimeformat-tools
bun add lqqtimeformat-tools
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2022-10-11 |
| First published | 2022-10-11 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 2.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | milu-lqq |

## Links

- npm: https://www.npmjs.com/package/lqqtimeformat-tools
- npm.io page: https://npm.io/package/lqqtimeformat-tools

## Dependencies (1)

- [lqqtimeformat-tools](https://npm.io/package/lqqtimeformat-tools.md) ^1.0.1

## Recent versions

- 1.0.2 (latest) — 2022-10-11
- 1.0.1 — 2022-10-11
- 1.0.0 — 2022-10-11

## README

## 安装方式

  npm install lqqtimeformat-tools

## 导入方式

  const mytools=require('lqqtimeformat-tools')

## 格式化时间

```
  function dateFormat() {
  var date = new Date()
  //年份
  var year = date.getFullYear()
  //月份
  var month = date.getMonth() + 1
  //日期
  var day = date.getDate()
  //小时 分钟 秒 
  var hh = date.getHours()
  var mm = date.getMinutes()
  var ss = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
  return `${year}年${month}月${day}日 ${hh}:${mm}:${ss}`
}
```

## 转义html

```
function zhuanHtml(html) {
  const str = html.replace(/<|>|"|&/g, (item) => {
    switch (item) {
      case '<':
        return '&lt;'
      case '>':
        return '&gt;'
      case '&':
        return '&amp;'
      case '"':
        return '&quot;'
    }
  })
  return str
}
```

## 还原html

```
function huanHtml(html) {
  const str = html.replace(/&lt;|&gt;|&amp;|&quot;/g, (item) => {
    switch (item) {
      case '&lt;':
        return '<'
      case '&gt;':
        return '>'
      case '&amp;':
        return '&'
      case '&quot;':
        return '"'
    }
  })
  return str
}
```

---
_Source: https://npm.io/package/lqqtimeformat-tools · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
