• 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
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

How to get current Date and Time from Sql Server

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good day. I'm using SQL Server and Springboot for my web api.

Database Property:


Springboot Model:


Sample Data:


Is there a way to get the current date and time from the main server when posting new data in springboot? As of now, @CreationTimestamp use the client pc's current datetime (which we can assume that the varies from desktop to desktop). It's working but the date should be from the server to maintain consistency.

Thanks.
 
Saloon Keeper
Posts: 11184
244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to CodeRanch!

Moises Bagsit wrote:As of now, @CreationTimestamp use the client pc's current datetime (which we can assume that the varies from desktop to desktop).


How do you figure? How would Hibernate have access to the client system?
 
Greenhorn
Posts: 16
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The date would only come from the client if the date is supplied by the client via a request. Otherwise, it's coming from the server.
 
This is my favorite tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!