时间戳与对象之间的转化

changeOrigin: true,//是否允许跨越

 

    // 获取某个时间格式的时间戳

    var stringTime = "2014-07-10 10:21:12";

    var timestamp2 = Date.parse(new Date(stringTime));

    timestamp2 = timestamp2 / 1000;

console.log(timestamp2)

 

var newDay = new Date();

console.log(Date.parse(newDay));

 

var newDay = +new Date();

console.log(newDay);

var newDate = new Date(1611309731000);  //实例化一个Date对象,将时间戳直接传入,注意一定是13

var time_str = newDate.toLocaleDateString(); //毫秒转化为时间

console.log(time_str)

 

  info.birthday[0] = null
      ? null
      : (new Date(info.birthday[0] + ' 01:00:00').getTime() / 1000 + 3600 * 8) * 1000;
    info.birthday[1] = null
      ? null
      : (new Date(info.birthday[1] + ' 23:59:59').getTime() / 1000 + 3600 * 8) * 1000;
  }
  //   console.log((new Date('2021-10-08' + ' 00:00:00').getTime() / 1000 + 3600 * 8) * 1000);
  //   new Date(time1).toISOString();
  const infodata = {
    pageOffset: 0,
    filter: {
      user: {
        nameIn: ['string'],
        genderIn: info.gender != undefined ? [info.gender] : [],
        birthdayGte: info.birthday[0] == null ? null : new Date(info.birthday[0]).toISOString(),
        birthdayLte: info.birthday[1] == null ? null : new Date(info.birthday[1]).toISOString(),
posted @ 2021-03-07 09:07  zjxgdq  阅读(99)  评论(0编辑  收藏  举报