a program to display date in dd/mm/yyyy format in javascript? And the other one in mm/dd/yyyy format | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

a program to display date in dd/mm/yyyy format in javascript? And the other one in mm/dd/yyyy format

just simple program eg (26/ jan/ 2018) only format in bracket to be the output

25th Jan 2018, 8:24 PM
James Ngai
James Ngai - avatar
2 Answers
+ 2
<!DOCTYPE html> <html> <body> <p id="demo"></p> <script> var d = new Date(); document.getElementById("demo").innerHTML = d.toDateString(); </script> </body> </html> output: fri jan 26 2018 fron ny research i gat that prog but still i dont need (friday) in my output.
25th Jan 2018, 11:21 PM
James Ngai
James Ngai - avatar
0
i get the solution finally tho no reactio lo! <html> <head><title></title> </head> <body> <script> now=new Date(); time=now.getFullYear(); document.write(time); time1=now.getMonth()+1; document.write('/'+time1+'/'); time2=now.getDate(); document.write(time2); </script> </body> <h </html>
27th Jan 2018, 5:34 PM
James Ngai
James Ngai - avatar