postman:日期得使用

方法一:

var Date = new Date()

var year = Date.getFullYear()      //2021

var month = Date.getMonth()+1 //6,月份是从0开始

var day = Date.getDate() //8 

var deliverDay= Date.getDate()+2

console.log(year,month ,day )

 pm.gloables.set("deliverDay",year+'/'+month +'/'+deliverDay)

 

方法二:

var moment = require(moment)

var date = moment().format("YYYY-MM-DD HH:mm:ss")

console.log(date )

pm.gloables.set("date",date)

 

 

posted @ 2021-06-08 16:31  文刀六日  阅读(564)  评论(0编辑  收藏  举报