• 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
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to get system date

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sir/mam
pls tell me in java how to get system date and store it in a variable
so that i can compare this variable with the database to get the data
 
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ammuswar,
I am not exactly sure what you mean by System date. But to get the current system date-time you can just create a new GregorianCalendar:
GregorianCalendar gc = new GregorianCalendar();
System.out.println( "Time is now: " + gc.getTime() );
Regards,
Manfred.
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I create a class called DateFields.java, to get an array of
three JComboBox's for dd,mm,yyy and where the dd or mm increses,
decreses to the selected month, day. Also if the selcted year is
a leap the mm,dd is set to it. it's a 250 lines of code.
I also provide a method called "setCurrentDate()" where the
comboboxs are automaticley set to the current date and I used
this line of code::
java.sql.Date currentDate = new java.sql.Date( System.currentTimeMillis() );
and it works,
and it could work for comparing to the database date.
I think you better use this rather calenders or whatever,
because it's getting very complecated.
If you have any question you better E-mail me at:
jkornbluh@netzero.com
because I wont visit this site to soon, I was just here because
I was searching on java printing stuff, I have a problem printing
a JTable while trying to tranlate it lower in the page,
if you (of anybody) can help me it will be a nice trade of.
Thanks
Joel Kornbluh
from Program IT team.
jkornbluh@netzero.com
 
Now I am super curious what sports would be like if we allowed drugs and tiny ads.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic