1

I have a chat online, I want to show the time that the user sent the message, I know I need JS for that, I've tried to do it, but it doesn't works, I call this function timeNow() everytime the user send a message, but time time that shows is the time that the user logged into the chat, I think it is not a real time hour, I was thinking, maybe I need to use Ajax or SetInterval function to do it? Can someone help me?

 Date.prototype.timeNow = function () {
            return ((this.getHours() < 10)?"0":"") + this.getHours() +":"+ ((this.getMinutes() < 10)?"0":"") + this.getMinutes();
         }  
  • Can you use moment JS? If so, you can pass a Date object representing the current time into a function like this one: `moment(date).format("MM/DD/YY h:mm a")` To get the current timestamp in the user's browser when they send the message: `moment(new Date()).format("MM/DD/YY h:mm a")` – Matt Dale Aug 20 '20 at 13:46
  • Can you see if the answer in this question help? https://stackoverflow.com/questions/23593052/format-javascript-date-as-yyyy-mm-dd – Tequilalime Aug 20 '20 at 14:01
  • I tried all methods, however, it doesn't work, I can send two messages in the chat, after seconds or minutes, but the time that appears is the same, why? Do I need a function that keeps running? How does setInterval? Or else I need something like Ajax to update the time with every message I send – Paula Silva Aug 20 '20 at 14:11
  • 1
    (sorry for the off) Ubuntu knows the Wifi drivers and all the Linux drivers are built into. It will be able to connect your wifi (in some % of the cases, there is no wifi driver for the chipset in the laptop. It happens very rarely and it worths the risk). The installer and everything is full GUI. Your hwrecs question was offtopic on the HwRecs SE, but I think it had been a good one on the https://superuser.com . – peterh Dec 15 '20 at 15:33
  • So are you answering a question I asked yesterday about drivers after formatting for Ubuntu? I believe that's it, thank you very much, I really wanted to know about it, thank you! – Paula Silva Dec 16 '20 at 16:48

0 Answers0