• 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
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Date in java

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a requirement to create periods from current date.

Ex: 1 to 15 jan - 1st period
16 to 31 jan - 2 nd period
1 to 15 feb - 3 rd period... so on upto 6 periods

Once my period moved out of 6th position that is on 7th, I have to get that date and last date of 6 period
and update records falling withing that range to say status x


Help on above requirement based on dates
 
Sheriff
Posts: 6414
1138
IntelliJ IDE jQuery Eclipse IDE Postgres Database Tomcat Server Chrome Google App Engine
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"jimmy Kc" please check your private messages regarding an important administrative matter.
 
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about a class that takes fromDate and toDate and then cumulate those?
 
Sheriff
Posts: 21804
104
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out java.util.Calendar.
 
jimmy Kulkarni
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Sebastian Janisch wrote:How about a class that takes fromDate and toDate and then cumulate those?



yes method will send from date and to date in date format
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So what exactly is the problem ?

Create a bean that holds two Dates and another class that represents your periods.

You should also prefer Calendar to Date. Almost everything in Date is deprecated and the Date class only works as a transfer object to Calendar instances.
 
jimmy Kulkarni
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please can you period me code snippet
 
Ranch Hand
Posts: 152
VI Editor Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what code do you have so far?

why not post it?
 
jimmy Kulkarni
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Matt Cartwright wrote:what code do you have so far?

why not post it?




I just have sysdate from database and nothing else.
I have to chk in wht period it falls
 
Rob Spoor
Sheriff
Posts: 21804
104
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

jimmy Kulkarni wrote:Please can you period me code snippet


We are NotACodeMill.

jimmy Kulkarni wrote:I have to chk in wht period it falls


Please UseRealWords.
 
I am going to test your electrical conductivity with this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!