Win a copy of Transfer Learning for Natural Language Processing (MEAP) this week in the Artificial Intelligence and Machine Learning 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
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

Format date fetched from DB

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am getting a DateTime field from informix Database using hibernate and need to reformat my date as 2016-11-24 12:45:41

I am getting date as "updateTime": "2012-08-31T12:19:50.000+0000".

Please help in how to reformat the date.


Hibernate is retrieving Date as Timestamp from Database

 
Saloon Keeper
Posts: 11882
253
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cross-posted at https://stackoverflow.com/questions/60922766/date-format-issue-with-hibernate-spring-informix

Pratibha, please notify all sites where you've posed your question of all other sites where you've posed your question. See BeForthrightWhenCrossPostingToOtherSites.
 
Marshal
Posts: 25436
65
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have a Timestamp object. Sure, it came out of a database but it makes no difference where it came from. It's a Timestamp object. So your question is only "How do I format a Timestamp object?" You may find it easier to find answers to that question.
 
Stephan van Hulst
Saloon Keeper
Posts: 11882
253
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As some users on StackOverflow have said, your question is unclear.

It doesn't make sense at all to want to 'reformat' a time stamp, because a time stamp is not a string. A format is a property of a string. Now, please answer the following questions:

  • What is the type of the column in Informix?
  • What is the value of the field that is displayed when you look at it in the Informix user interface?
  • Does the value you get in Hibernate match the value you see in Informix?
  • Do you want to change the value you get in Hibernate to something different from what you see in Informix?
  • If you get matching values and you want to change the date and time in Hibernate, then WHY do you want to change it?
  •  
    We've gotta get close enough to that helmet to pull the choke on it's engine and flood his mind! Or, we could just read this tiny ad:
    Two software engineers solve most of the world's problems in one K&R sized book
    https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
      Bookmark Topic Watch Topic
    • New Topic