Win a copy of Event Streams in Action this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

How do I display a date with JavaScript?

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all -

I have a question regarding JavaScript... how do I display a date on a website with JavaScript?

Any help would be great.

Thanks!

- Josh
 
Marshal
Posts: 67273
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's not much detail to go on. Where is the date data coming from? Are you using other script on the page? A library such as jQuery? A framework such as AngularJS or React? If not, is the page generated by JSP or some other templating system?

The high-level answer is to format the date as text, then insert the text into the proper location in the DOM. How you best do all that depends on the answers to the above questions.
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Refer following links:

https://www.quackit.com/javascript/javascript_date_and_time_functions.cfm

https://dzone.com/articles/working-with-dates-in-javascript-json-and-oracle-d
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!