🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@kejiweixun/beijing-time

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

@kejiweixun/beijing-time

在任意时区运行本函数,都可以获得此时此刻的北京时间

unpublished
latest
npmnpm
Version
2.3.3
Version published
Maintainers
1
Created
Source

用途

在任意时区运行本函数,都可以获得此时此刻的北京时间。

安装

npm i @kejiweixun/beijing-time

使用

获得此时此刻的北京时间

const getBeijingTime = require("@kejiweixun/beijing-time");
const beijingTime = getBeijingTime();

传入一个时间,把它转换为北京时间

const getBeijingTime = require("@kejiweixun/beijing-time");
const beijingTime = getBeijingTime("2022-03-22T09:00:00Z");

返回

{
  year: 2022,
  month: 3, //1-12,不是0-11
  date: 22,
  day: 2, //0-6,0表示星期日
  weekday: "周二",
  weekdayLong: "星期二",
  hour: 17,
  minute: 0,
  second: 0,
  millisecond: 0,
  dateMMDD: '2022-03-22',
  dateMD: '2022-3-22',
  time: '17:00:00',
  isoString: '2022-03-22T17:00:00+08:00',
  timestamp: 1647939600000
}

FAQs

Package last updated on 25 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts