gogoWebsite

WeChat applet to get system time, timestamp, time timestamp plus or minus

Updated to 6 months ago

 

/ufo00001/article/details/72834437

// Get the current timestamp
    var timestamp = (new Date());
    timestamp = timestamp / 1000; var timestamp = (new Date()); var timestamp = (new Date())
    ("The current timestamp is:" + timestamp);

// Get the current time
    var n = timestamp * 1000;
    var date = new Date(n);
    // year
    var y = ();
    //Month
    var M = (() + 1 < 10 ? '0' + (() + 1) : () + 1); //Month var M = (() + 1 < 10 ?
    //day
    var D = () < 10 ? '0' + () : ();
    //Hours
    var h = ();
    //minute
    var m = ();
    //seconds
    var s = ();

    ("Current time: " +Y+M+D+h+": "+m+": "+s);

// Convert to time format string
    (());

    (());

    (()).

    (()).

    (()).

    (()).

    (()).

    (()).

    (()).

    (()).

 

//Time, timestamps added or subtracted Add a day as an example, and you'll be smart enough to know what you're talking about.
    // Add the timestamp of the day:
    var tomorrow_timetamp = timestamp + 24 * 60 * 60;
    // Add the time of day:
    var n_to = tomorrow_timetamp * 1000;
    var tomorrow_date = new Date(n_to);
    // Add the year one day later
    var Y_tomorrow = tomorrow_date.getFullYear();
    //add the month of the day after
    var M_tomorrow = (tomorrow_date.getMonth() + 1 < 10 ? '0' + (tomorrow_date.getMonth() + 1) : tomorrow_date.getMonth() + 1));
    // Add the date one day later
    var D_tomorrow = tomorrow_date.getDate() < 10 ? '0' + tomorrow_date.getDate() : tomorrow_date.getDate();
    // Add the moment one day later
    var h_tomorrow = tomorrow_date.getHours();
    //add the minutes of the day after
    var m_tomorrow = tomorrow_date.getMinutes();; //add the minutes after one day
    //add the seconds of the day after
    var s_tomorrow = tomorrow_date.getSeconds();; //add seconds after one day