Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

JQuery convert java.util.Date into format MM/dd/yyyy?

 
Ranch Hand
Posts: 491
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Server:


Client:

JQuery ajax recieve from the server a date field: 1382470660484

and show 1382470660484.

1. Is there a JQuery function that convert the above date value 1382470660484 into format MM-dd-yyyy?

2. Or there is some thing wrong with what I do with java on the server side in the first place ?
 
Sheriff
Posts: 67620
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What's wrong with just using JavaScript's Date type?

Or, the jQuery UI datepicker has formatting functions.

Or, if you're a big fan of Java's SimpleDateFormat, here's a JavaScript implementation.
 
H Paul
Ranch Hand
Posts: 491
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your hint count!: java.text.SimpleDateFormat. Thanks Big Bear!

Case: Spring MVC 3 Restful return an object X that has java.util.Date in the JSON format that JQuery Ajax expects

0. Debug, read doc again, TCP/IP mon, Google, then solution:

Before travel thru HTTP, a MappingJackson2HttpMessageConverter convert X into http-text.
The Date field into [bignumber]

This is here that I should re-config/telll MappingJackson2HttpMessageConverter to use format MM/dd/yyyy



2. Recap: the issue is knowing well the Spring MVC 3 module.
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic