How to display Date & Time in JavaScript - JavaScript Tutorial 84

Опубликовано: 29 Сентябрь 2024
на канале: ChidresTechTutorials
2,004
51

Notes for You:: How to display Date & Time in JavaScript - JavaScript Tutorial 84

JavaScript Date Display Functions:

getTime():Number
- Returns the number of milliseconds elapsed since midnight January 1, 1970, universal time.

toString():String
- Returns a String representation of the day, date, time, and time zone in local time .

toUTCString():String
- Returns a String representation of the day, date, and time in universal time .

toDateString():String
- Returns a string representation of the day and date only, and does not include the time or timezone.

toTimeString():String
- Returns a String representation of the time and timezone only, and does not include the day and date.

toLocaleString():String
- Returns a String representation of the day, date, time, given in local time.

toLocaleDateString():String
- Returns a String representation of the day and date only, and does not include the time or timezone.

toLocaleTimeString():String
- Returns a String representation of the time only, and does not include the day, date, year, or timezone.


Example Code:

var dateObject = new Date();
document.write(dateObject);
document.write(dateObject.toString());
document.write(dateObject.toUTCString());
document.write(dateObject.toDateString());
document.write(dateObject.toTimeString());
document.write(dateObject.toLocaleString());
document.write(dateObject.toLocaleDateString());
document.write(dateObject.toLocaleTimeString());
document.write(dateObject.getTime());

=========================================

Follow the link for next video:
JavaScript Tutorial 85 - Date Object Getter Methods in JavaScript
   • JavaScript Date Functions - JavaScrip...  

Follow the link for previous video:
JavaScript Tutorial 83 - How to create Date Objects in JavaScript
   • How to create Date Object in JavaScri...  

=========================================

JavaScript Tutorials Playlist:-
   • JavaScript Tutorials  

=========================================
Watch My Other Useful Tutorials:-

jQuery Tutorials Playlist:-
   • jQuery Tutorials  

jQuery UI Tutorials Playlist:-
   • jQuery UI Tutorials  

Bootstrap Tutorials Playlist:-
   • Bootstrap4 Tutorials  

=========================================

► Subscribe to our YouTube channel:
   / chidrestechtutorials  

► Visit our Website:
https://www.chidrestechtutorials.com

=========================================
Hash Tags:-
#ChidresTechTutorials #JavaScript #JavaScriptTutorial