How do I get the day of the week with a timestamp in JavaScript? I would like to get this from the timestamp I specify, not the current date.
thanks
var timestamp = 654524560; // UNIX timestamp in seconds var xx = new Date(); xx.setTime(timestamp*1000); // javascript timestamps are in milliseconds document.write(xx.toUTCString()); document.write(xx.getDay()); // the Day
var timestamp = 1400000000; var a = new Date(timestamp*1000); var days = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']; var dayOfWeek = days[a.getDay()]
Now the "day of the week" is in the variable dayOfWeek.
Try the following:
var currentTime = new Date(); var day = currentTime.getDate();
Source: https://habr.com/ru/post/885719/More articles:How to disable vertical scrolling webview to load the entire page as another column - androidEntity Framework Code-First - Defining Relationships with MembershipUser - .net-4.0Using libmms with Objective-C - c ++Why can't Xcode find this header file? - iosRuby SSO, CAS, oauth, userstore. What are my options? - authenticationHow to write a column name with a dot (".") In a SELECT clause? - sqlHow to convert rtf string to text in C # - c #The Big Question - Algorithmic Analysis III - algorithmGtk terminal widget - terminalhow to avoid memory loss when storing UTF-8 characters (8 bits) in a Java character (16 bits). two in one? - javaAll Articles