alvin alexander
alvin alexander

favorite books

categories

  • alaska (25)
  • android (138)
  • best practices (63)
  • career (50)
  • colorado (21)
  • cvs (27)
  • design (33)
  • drupal (120)
  • eclipse (6)
  • funny (3)
  • gadgets (108)
  • git (15)
  • intellij (4)
  • java (429)
  • jdbc (26)
  • swing (74)
  • jsp (9)
  • latex (26)
  • linux/unix (289)
  • mac os x (315)
  • mysql (54)
  • ooa/ood (11)
  • perl (156)
  • php (97)
  • postgresql (17)
  • programming (43)
  • ruby (56)
  • scala (640)
  • sencha (23)
  • servlets (10)
  • technology (84)
  • testing (13)
  • uml (24)
  • zen (47)

In Scala, how to get the day of the year

By Alvin Alexander. Last updated: April 19 2018

Scala date FAQ: How do I determine the day of the year in Scala?

Solution: Use the Java Calendar class, as shown here:

scala> import java.util.Calendar
import java.util.Calendar

scala> Calendar.getInstance.get(Calendar.DAY_OF_YEAR)
res0: Int = 104

I’m writing this on April 14, 2018, which is the 104th day of the year.

scala
scala
java
calendar
day
day of year
date
year
  • How to convert a Java Date to a Long value
  • A Scala nscala-time example (days to Christmas)
  • A Scala current date and time example
  • How to get the current year as an integer in Scala
  • A free JSP-based calendar
  • Happy 100th Day of 2019

books i’ve written

  • The Earth keeps getting hotter
  • Scala: How to search a directory tree with SimpleFileVisitor and Files.walkFileTree
  • A tub of applesauce exploded
  • “She seduced me with baked goods”
  • “It couldn’t be done”
  • Live Brave (bracelet)
Links:
front page alvin on twitter search privacy terms & conditions
alvinalexander.com
is owned and operated by
Valley Programming, LLC
 
In regards to links to Amazon.com, As an Amazon Associate
I (Valley Programming, LLC) earn from qualifying purchases
java
java applets
java faqs
misc content
java source code
test projects
lejos
Perl
perl faqs
programs
perl recipes
perl tutorials
 
Unix
man (help) pages
unix by example
tutorials
source code
warehouse
java examples
drupal examples
misc
privacy policy
terms & conditions
subscribe
unsubscribe
wincvs tutorial
function point
analysis (fpa)
fpa tutorial
 
 
Other
contact me
rss feed
my photos
life in alaska
how i sold my business
living in talkeetna, alaska
my bookmarks
inspirational quotes
source code snippets
alvinalexander.com is owned and operated by Valley Programming, LLC
 
In regards to links to Amazon.com, “As an Amazon Associate
I (Valley Programming) earn from qualifying purchases”