• 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

withDayOfYear method

 
Ranch Hand
Posts: 125
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

Please could someone explain to me why the below code returns 2006-01-29?
 
Greenhorn
Posts: 4
1
VI Editor Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, as the docs say "Returns a copy of this LocalDate with the day-of-year altered." so basically you can specify a number between 1 and 365-366 and the function will return your altered date with corresponding day. So for example, we have a date 2021-05-26, you then use this function and pass 240, method counts 240 days from the beginning of year 2021, which results with 28 of august and return you this date, so now you have 2021-08-28.
reply
    Bookmark Topic Watch Topic
  • New Topic