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

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -