Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code 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
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

SQL Current Time

 
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Is it possible to get a time stamp in SQL in the format of a long datatype similar to the java Method System.currentTimeMillis() .

I know sql has functions similar to SELECT NOW(); which return something like "2009-06-05 16:10:09" , but i would like to hava a method to return it as a long number. As i have saved alot of my time instances in the database as long numbers and now i have the need to do a select based on the current time and instance of a saved long number. I dont think a SELECT statement would work if i tried something like SELECT .... WHERE (SELECT NOW()) < column.TimeMillisAsLong.

Best
Mark Hughes
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What wrong with:

 
Mark Hughes
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Paul i did not think of that, very good. Ill give it a go.

Best
Mark Hughes
 
The glass is neither half full or half empty. It is too big. But this tiny ad is just right:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic