Skip to content

JS achieve Unix timestamp (Unix timestamp) conversion tool toolfk online Programmer toolbox

hubs edited this page Jan 4, 2019 · 1 revision

     This paper to recommend [ToolFk] is a programmers often use a free online test kit, ToolFk feature is focused on everyday programmer development tools, without having to install any software, as long as the content execution affixed by a button, able to obtain the contents of the desired results.ToolFk also supports   BarCode Barcode generated online ,  QueryList collector ,  PHP code is run online ,  PHP confusion, encryption, decryption ,  Python code is run online JavaScript online operation ,YAML formatting tools , HTTP simulation query tool HTML online toolbox JavaScript online Toolbox ,CSS online toolbox JSON online toolbox unixtime timestamp conversion Base64 / the URL of / native2ascii conversion CSV conversion kit XML online toolbox the WebSocket online tools Markdown online toolbox Htaccess2nginx conversionHex conversion online online encryption toolkit ,online pseudo-original tools online APK decompile online web screenshot tool online random password generation online generate two-dimensional code qrcode online Crontab Expression Builder ,the online short URL Generator Online calculator tool . And more than 20 daily programmer development tools, can be considered a very comprehensive website programmer's toolbox.

Site name: ToolFk
website links: https://www.toolfk.com/
Tools link: https://www.toolfk.com/tool-convert-unixtime

? Teaching Code

This tool [online? Timestamp conversion tool] depends on the JavaScript implementation, the page is shown below

STEP 1

STEP 2

? THE CORE CODE IS AS FOLLOWS

$ (Function () {
    var js_timestamp_now = $ ( '# js_timestamp_now');
    var js_timestamp = $ ( '# js_timestamp');
    var js_timestamp_o = $ ( '# js_timestamp_o');
    var js_datetime_o = $ ( '# js_datetime_o');
    var js_timer_stop = $ ( '# js_timer_stop');
    var js_timer_start = $ ( '# js_timer_start');
    var js_timestamp_unit = $ ( '# js_timestamp_unit');
    var js_timestamp_unit_o = $ ( '# js_timestamp_unit_o');

    var now = Math.round (new Date () / 1000);
    js_timestamp.val (now);
    js_datetime_o.val (moment (now * 1000) .format ( 'YYYY-MM-DD HH: mm: ss'));

    var timer = setInterval (function () {
        var now = Math.round (new Date () / 1000);
        js_timestamp_now.text (now);
    }, 1000);
    js_timestamp_now.on ( 'click', function (e) {
        e.preventDefault ();
        js_timestamp.val ($ (this) .text ());
    });
    js_timer_start.hide ();
    js_timer_stop.show ();

    js_timer_stop.on ( 'click', function (e) {
        js_timer_stop.hide ();
        e.preventDefault ();
        if (timer) clearInterval (timer);
        js_timer_start.show ();
    });

    js_timer_start.on ( 'click', function (e) {
        e.preventDefault ();
        js_timer_start.hide ();
        if (timer) clearInterval (timer);
        timer = setInterval (function () {
            var now = Math.round (new Date () / 1000);
            js_timestamp_now.text (now);
        }, 1000);
        js_timer_stop.show ();
    });

    $ ( '# Js_convert_timestamp'). On ( 'click', function (e) {
        e.preventDefault ();
        var timestamp = js_timestamp.val ();
        timestamp = timestamp.replace (/ ^ \ s + | \ s + $ /, '');
        if (! / ^ \ d + $ /. test (timestamp)) {
            alert ( "@ lang ( 'toolfk.lang_text_valid_txt')");
            return;
        }
        if (timestamp.length> 10) {
            timestamp = timestamp / 1000;
        }
        timestamp * = 1000;
        var YmdHis = moment (timestamp) .format (js_timestamp_unit.val ());
        toolfk.report ( 'js_convert_timestamp', YmdHis);
        $ ( '# Js_datetime') val (YmdHis).;
    });

    $ ( '# Js_convert_datetime'). On ( 'click', function (e) {
        e.preventDefault ();
        var time = moment (js_datetime_o.val (), js_timestamp_unit_o.val ());
        var value = time.unix ();
        js_timestamp_o.val (value);
        toolfk.report ( 'js_convert_datetime', value);
    });
});

It is worth a try for three reasons:

  1. Integrate various programmers often used in development and testing tools.

  2. Simple and beautiful atmosphere of the site pages

  3. Online support formatting code execution, APK online decompile, online high-strength password generator, two dozen screenshots online web tools service

  4. Also recommend its sister network  www.videofk.com  video download Toolbox 

This link: http://www.hihubs.com/article/369

Clone this wiki locally