当前位置:网站首页>Postman generate timestamp, future timestamp
Postman generate timestamp, future timestamp
2022-07-07 15:46:00 【Test super brother】
Support acquisition : Current timestamp 、 Future timestamp 、 Specify time stamp 、 The current date is 、 In the future
- Get the current timestamp
// Get the current timestamp
let timestamp = (new Date()).getTime().toString();
// Console output timestamp
console.log(" Current timestamp :",timestamp)
// hold startDate Set timestamp as environment variable
pm.environment.set("startDate", timestamp);
demonstration :
- Specify Date , Generate timestamps
// Set date timestamp
var data_f = new Date(2022,7.05);
var appoint = data_f .getTime()
console.log(" Specify a date timestamp :",appoint)
pm.environment.set("expiration", appoint);
demonstration :
- Get future timestamp
// Get the current time in the format of year month day
var date = new Date();
// Set the current time to 3 Days later
date.setDate(date.getDate() + 3)
// Check whether the modification is successful
console.log(date)
// Put the revised time , Convert to timestamp
var toTimes = date.getTime()
// Check the timestamps
console.log(toTimes)
// hold toTimes Set to expirationDate environment variable
pm.environment.set("expirationDate", toTimes);
demonstration :
- Get future timestamp And “ Sand carving method ”:

// Future timestamp
let appoint = new Date().getTime();
// Three days total milliseconds =259200000
appoint=appoint+259200000
console.log('72 Time stamp of ', appoint)
pm.environment.set("expirationDate", appoint);
demonstration :
- obtain : Specific date (YYYYMMDDHHmmss)
// Quoting third-party libraries :moment Equate to import moment from 'moment'
var moment = require('moment');
// call moment() Method to get the current time , And format , With variable currentRime receive
var currentTime = moment().format(" YYYYMMDDHHmmss");
// Print the value of the current time to the console
console.log(" The current time is :", currentTime);
// Put it in the environment variable
pm.environment.set("beginTime", currentTime);
demonstration :
- Get future time :10 Minutes later
// Quoting third-party libraries :moment Equate to import moment from 'moment'
var moment = require('moment');
// Future time , such as : At the present time 10 Minutes later , Accurate to seconds
var beginTime = moment().add(10,"m").format(" YYYYMMDDHHmmss");
// Starting time , At the present time 1 Hours later, , Accurate to seconds
var endTime = moment().add(1,"H").format(" YYYYMMDDHHmmss");
console.log("10 Time in seconds :", beginTime);
console.log("1 Hours later :", endTime);
demonstration :
- Date format : 2022-07-04T11:27:15
// 72 Hours later
var moment = require('moment');
var YTD = moment().add(72,"H").format(" YYYY-MM-DDTHH:mm:ss");
console.log("72 Mm / DD / yyyy time after :",YTD);
// Set as variable
pm.environment.set("tokenExpirationTime", YTD);
demonstration :
- Generate current time , The type is :“2022-07-01T05:18:17.580Z”
var a = new Date()
console.log(" current time :",a)
demonstration :
- Three days after generation
var a = new Date()
a.setDate(4)
console.log(" Future time :",a)
demonstration :
边栏推荐
- 【目标检测】YOLOv5跑通VOC2007数据集
- [quick start of Digital IC Verification] 18. Basic grammar of SystemVerilog learning 5 (concurrent threads... Including practical exercises)
- [target detection] yolov5 Runtong voc2007 data set
- Webgl texture
- 【數字IC驗證快速入門】26、SystemVerilog項目實踐之AHB-SRAMC(6)(APB協議基本要點)
- Tkinter after how to refresh data and cancel refreshing
- 【数字IC验证快速入门】20、SystemVerilog学习之基本语法7(覆盖率驱动...内含实践练习)
- 使用cpolar建立一个商业网站(2)
- The download button and debug button in keil are grayed out
- After UE4 is packaged, mesh has no material problem
猜你喜欢

【數字IC驗證快速入門】26、SystemVerilog項目實踐之AHB-SRAMC(6)(APB協議基本要點)

Ue4/ue5 multi thread development attachment plug-in download address

【数字IC验证快速入门】26、SystemVerilog项目实践之AHB-SRAMC(6)(APB协议基本要点)

LeetCode3_ Longest substring without duplicate characters

Vertex shader to slice shader procedure, varying variable

LeetCode1_ Sum of two numbers

Virtual memory, physical memory /ram what

The rebound problem of using Scrollview in cocos Creator

HW primary flow monitoring, what should we do

Annexb and avcc are two methods of data segmentation in decoding
随机推荐
【数字IC验证快速入门】26、SystemVerilog项目实践之AHB-SRAMC(6)(APB协议基本要点)
The "go to definition" in VS2010 does not respond or prompts the solution of "symbol not found"
Syntax of generator function (state machine)
【数字IC验证快速入门】22、SystemVerilog项目实践之AHB-SRAMC(2)(AMBA总线介绍)
Getting started with webgl (2)
Virtual memory, physical memory /ram what
Webgl texture
[server data recovery] a case of RAID data recovery of a brand StorageWorks server
Steps to create P8 certificate and warehousing account
【搞船日记】【Shapr3D的STL格式转Gcode】
Shader Language
LeetCode2_ Add two numbers
HW初级流量监控,到底该怎么做
LeetCode3_ Longest substring without duplicate characters
Android -- jetpack: the difference between livedata setValue and postvalue
Mathematical modeling -- what is mathematical modeling
Write sequence frame animation with shader
Annexb and avcc are two methods of data segmentation in decoding
How to deploy the super signature distribution platform system?
Runnable是否可以中断








