so we will give you an example how to get Date who that same with your computer time
** **
here is the explanation from the example,
the button above will show the time when you clicked, and will replace the element in tag <P></P> if have a same id target,
and how if you want full customize the date with your language ?
if you are from indonesian , your time set will be different with other country
if other country use ("mm/dd/yy") but indonesian use ("dd/mm/yy"), and how to make it ?
if you want to customize the date you must understand about Array First so lets learning by doing, we will give you an example
** **
Array in JavaScript start from zero (0) , you can call the array with number
for example above is ,day is Array and have a data ("Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday")
if you want to show Monday ,you should call the array with the index of Monday
example : day[0]
the code will print out on the screen is Monday because the position monday in the index zero or 0
and the important thing if you want to make a custom Date you must create the Object First
and this is the table for access the method of the Date();
Method | Explain |
---|---|
getDate() | value of Date from (1..31) |
getDay() | value of Day from (0..6) |
getFullYears() | show the full years 2017 |
getMonth() | number of month (0..11) |
getHours() | show the hours value |
getMinute() | show the minute value |
getSeconds() | show the seconds value |
if you want to get value of day you just write Object(dot)Method
example get Value of Day
hello = new Date(); << Create Object
hello.getDay(); the result is value of what day now
and you can use to all the method with the similar way
and don't forget to create the Array first if you want to customize with your own style
keep Reading and Cheers
if you feel this article help you , please Share and Comment Below Thanks
Java Script get Time date and Years
4/
5
Oleh
Fata EL Islami