Friday, September 22, 2023

JS POST Function MMT

 Nc()((function(e, t, n, a) {
            var r = Rn().valueOf(),
                i = {
                    multiline: !0,
                    source: t,
                    target: n,
                    q: e,
                    hints: a,
                    ts: r,
                    verify: ra()("webkey_E3sTuMjpP8Jez49GcYpDVH7r#" + r + "#" + e).toString()
                };
            return Ra().post("/translate", i, {
                headers: {
                    "X-HTTP-Method-Override": "GET"
                }
            }).then((function(e) {
                var t = e.data.data;
                return {
                    translation: t.translation,
                    detectedLanguage: t.detectedLanguage
                }
            }))
        }), 800)

 

ts parameter is the time stamp

timeStamp = Date.now()

Timestamp in milliseconds

// 👇 Current timestamp in milliseconds
function getCurrentTimestamp() {
  return Date.now();
}
Get the timestamp of the current time in milliseconds.

The timestamp is milliseconds since January 1, 1970 in UTC. The Date.now() function in JS returns the timestamp of the current time.

Timestamp from a date string

If you already have a Date object, you can use the prototype methods getTime() or valueOf() to convert it to timestamp:

const exactDate = '09/19/2022 10:58:13';

// 👇 Get the timestamp when you already have the date object
const exactDateTimestamp = new Date(exactDate).getTime();

console.log(exactDateTimestamp); // 1663574293000
Convert the date to a timestamp in JS.
  1. Create a new Date object from a date string by using the constructor.
  2. Call the getTime() function on the Date object to get the timestamp in milliseconds.
  3. Divide the result by 1000 and round it down to get a Unix timestamp.

The getTime() and valueOf() functions do the exact same thing and can be used interchangeably.

Note: depending on the browser settings, such as privacy.reduceTimerPrecision or privacy.resistFingerprinting, your result may be rounded, and not come in milliseconds. If that can cause a problem for you, consider implementing your own checks for that. Read more on MDN.

The Unix timestamp is in seconds rather than milliseconds. Simply divide the timestamp by 1000:

// 👇 To get UNIX timestamp, divide by 1000 function getCurrentUnixTimestamp() { return Math.floor(Date.now() / 1000); } const exactDate = '09/19/2022 10:58:13'; // 👇 Get the timestamp when you already have the date object const exactDateTimestamp = new Date(exactDate).getTime(); console.log(exactDateTimestamp); // 1663574293