I am trying to get it to display in my nav bar, similar to this page: https://www.blackcard.com/, so a table does not seem like the way to go. Of course, I may be wrong.
Also, I am using Bootstrap, if that matters at all.
Let me know if you all have any ideas.
I would use moment.js for this
you will need these two files:
With moment.js, you could do the below:
//create a "moment" object from the current date/time //use the timezone functionality to to set the timezone of the "moment" //specify the format to display just the time var newYork = moment.tz("America/Los_Angeles").format("h:mm: A"); var london = moment.tz("Europe/London").format("h:mm: A"); var hongKong = moment.tz("Asia/Hong_Kong").format("h:mm: A"); var tokyo = moment.tz("Asia/Tokyo").format("h:mm: A"); //put them to use $("#myCoolNavBarr").append("NY "+newYork+ " --- LDN " +london+ " --- HK " +hongKong+ " --- TYO " +tokyo)
Here is a working JsFiddle
©2020 All rights reserved.