javascript - How to use UNIX time in HTML Datetime attribute? -


i'm working on single page chat application, , when displaying message sent user ,i want other users see same exact time message sent in , correct time regardless user's computer time or other reason. understood unix time job ,and want use in app , put inside datetime html attribute . there way in html or should use js that?

note: think this question isn't relevant me because first want use attribute datetime , second thing want use unix time .

any appreciated.thank you.

something this?? can set datetime attribute of time tag date.toisostring function since 1 of supported formats time tag.

var unixtime = 0; // fill in epoc time here.  var isotime = new date(unixtime).toisostring()  timeel.textcontent = unixtime+' --- '+isotime+' --- '+new date(isotime).tostring();  timeel.setattribute('datetime', isotime )
<time id="timeel"></time>


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -