Api

MethodDatetotimestamp

OpenAPI > Method > dateToTimestamp

OpenAPI.Method.dateToTimestamp() method

日期转时间戳, 格式 1970/01/01 00:00:00 或 1970-01-01 00:00:00

Signature:

static dateToTimestamp(date: string): number;

Parameters

Parameter

Type

Description

date

string

日期

number

Example

const timestamp = OpenAPI.Method.dateToTimestamp('2024-01-01') // 返回 1704038400000
const timestamp = OpenAPI.Method.dateToTimestamp('2024/01/01') // 返回 1704038400000

Copyright © 2021 - 2025