• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

How to get current Date and Time from Sql Server

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 14692
330
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic