Win a copy of Succeeding with AI 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
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
Sheriffs:
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • fred rosenberger
  • Frits Walraven

java- how to get/use current date+time in query to SQL Server database

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to store the current date+time into a table in SQL Server.

Separately, I also want to query the table (in which date+time was stored) and then obtain the date+time as a string value in format YYYYMMDDHHMMSS.

My program is in Java, and I am basically using a SQL Azure database.
 
lowercase baba
Posts: 12839
52
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well...what have you tried?
 
Arvind Ik Chari
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I haven't tried anything yet-- I thought I would google about my requirement -- I have not had to use SQL Server so far(this is the first time I am storing/retrieving date in SQL Server)...and what I found is that its quite complicated to convert Java date-> SQL date.

I did search around for this requirement on Stack Overflow and CodeRanch-- I searched around for other questions similar to my own-- but the closest match on SO only deals with one part of date+time (not both date and time)

Thanks,
Arvind.
 
Marshal
Posts: 69051
275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you found any JDBC tutorials? They might tell you about your problem. Start here.

I shall try duplicating this question in a databases forum; you might get more attention like that.
 
I hired a bunch of ninjas. The fridge is empty, but I can't find them to tell them the mission.
Try Free Java/.NET Libraries for Word Excel PowerPoint and PDF
htttp://www.e-iceblue.com/free-apis.html
    Bookmark Topic Watch Topic
  • New Topic