Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to convert Unix timestamp to time using Javascript

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 481
    Comment on it

    Hello Reader! If you having the timestamp generated by Unix and you want it to be in format of time then you can use the example code below:-

    function MakeTime(TimeUnix) {
    
        var d = new Date(TimeUnix);
        var h = (d.getHours().toString().length == 1) ? ('0' + d.getHours()) : d.getHours();
        var m = (d.getMinutes().toString().length == 1) ? ('0' + d.getMinutes()) : d.getMinutes();
        var s = (d.getSeconds().toString().length == 1) ? ('0' + d.getSeconds()) : d.getSeconds();
    
        var time = h + '/' + m + '/' + s;
    
        return time;
    }
    
    var Time = MakeTime(1535100000);
    console.log(myTime); 
    

    output:-

     07/24/2018
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: