简体   繁体   English

WhatsApp的lastseen功能如何

[英]WhatsApp lastseen function how to

In order to retrieve the lasteen information for specific contact from whatsApp web interface I run the following code in Chrome 63.xx build it retrieves the following information highlighted with code. 为了从whatsApp Web界面检索特定联系人的最新信息,我在Chrome 63.xx build中运行以下代码,它会检索以下用代码突出显示的信息。 But I don't know how to interpret it, I suspect that t: 1513932466 value at the end is the format for data and time, which is written in integer format. 但是我不知道该怎么解释,我怀疑t: 1513932466的末尾值是数据和时间的格式,它是以整数格式编写的。

So my question is how to translate that into something as human readable format such as date + time ? 所以我的问题是如何将其转换为人类可读的格式,例如日期+时间?

Store.Wap.lastseenFind("phone_number" + '@c.us').then(function(r){ console.log(r)})

t {_flags: 0, 
   _value: undefined, 
   _onFulfilled: ƒ, 
   _onRejected: undefined,
   _context: undefined, 
   …}control: undefined
   x: undefined_child: undefined_children: undefined_context: 
   undefined_control: undefined_flags: 5_onFulfilled: ƒ (r)_onRejected: 
   undefined_parent: undefined_resolveLevel: 2_thenableParent: null_value: 
   undefined__proto__: Object
   VM36:1 {t: 1513932466}
   t: 1513932466__proto__: Object

I'm not sure what Whatsapp returns, but the numeric value you have given is a unix timestamp and you can convert it to a human readable date format using almost any of the languages you use. 我不确定Whatsapp会返回什么,但是给定的数值是unix时间戳,您可以使用几乎所有使用的语言将其转换为人类可读的日期格式。

Since you have used Javascript, this is how to convert your timestamp to a date format. 由于您使用过Javascript,因此这是将时间戳转换为日期格式的方法。

You need to multiply the timestamp by 1000 to convert it to milliseconds. 您需要将时间戳乘以1000才能将其转换为毫秒。

var timestamp = 1513932466;
var datetime = new Date(timestamp * 1000);

console.log(datetime);

Hope it helps! 希望能帮助到你! Feel free to ask if you need to know anything :) 随时问您是否需要知道什么:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM