how to display time and date in Javascript Programming Language #1

Capture1.JPG

Before we proceed to display the time and date in the Javascript programming language, you can use applications such as sublime or other applications that support programming.


Immediately, I will give several steps to display today's time and date automatically using only the button that we will create and the steps are as follows:

2.JPG

1.First, you must first create a header or title that you want to create using the code in the image above, here I created the header name "My First JavaScript raza oktafian On Hive" in this header you can make whatever you want, what is the name of the header you want want you to do

3.JPG

2.The second step here I create a button for us to click and if we click the button it will immediately appear on today's date and time where in the source code we have to create a "button type" which is where this works to create a button and after we enter the source code " Onclick " which is where this works so that the button can be pressed and we will make a call " getElementById " this function is to call the attribute of the element that we will use or the document that will be saved , on " getElementById ( Demo) " which says ( Demo ) you can change according to your needs, after that we will enter the date and time call with the source code " innerHTML = Date ( ) " which will work to view and call the time and date according to your internet clock when finished we will write in the button which you can see in the image above.

4.JPG

3.the last step we have to create an element id where we have created a " GetElementByid ( Demo ) " and the closing of our function must match what we wrote earlier " Demo " this function is to see the element attributes that we created so that when " Run " these attributes it reads if we make the element attribute with a different name the function call will be an error.


And to see the full results as shown below:

5.JPG


That's all from me for discussing how to display the date and time using the button, if there is an error when I write I apologize because I am also learning to write articles well. Hopefully with the knowledge that I provide can be useful for you and you can try it at home with the tutorial that I provide.

See you tomorrow in the article about JavaScript Programming Language :)

H2
H3
H4
3 columns
2 columns
1 column
1 Comment
Ecency