SupportWriter space ↗
REFERENCE LIBRARY

References from other publishers

Republished articles with source attribution. This collection is separate from Diary Coding’s original guides and does not display ads.

Read original guides → · Editorial policy

FOR YOUR CURIOSITY

Latest notes.

SPRING CORE / NOTES</>↗
Spring Core12 Mar 2012

How do I inject a bean through constructors?

The following example demonstrate how we can inject a bean through their constructors. We will create a couple interfaces and classes for this purpose. First we will create the Singer interface and the Instrument interface. The Singer interface define a single method call sing() that will enable the implementation to sing a song. The second […]

Wayan · 4 min read
JODA-TIME / NOTES</>↗
Joda-Time27 Feb 2012

How do I format date in Joda-Time using ISODateTimeFormat class?

This example demonstrate how to use the ISODateTimeFormat class to format the date time information in Joda-Time. package org.kodejava.joda; import org.joda.time.DateTime; import org.joda.time.format.ISODateTimeFormat; public class ISODateTimeFormatDemo { public static void main(String[] args) { DateTime dateTime = DateTime.now(); // Returns a basic formatter for a full date as four digit // year, two-digit month of year, […]

Wayan · 2 min read
JODA-TIME / NOTES</>↗
Joda-Time27 Feb 2012

How do I use Joda-Time’s Instant Class?

An instant in the datetime continuum specified as a number of milliseconds from 1970-01-01T00:00Z. Some classes that represent an instance in the Joda-Time library includes the Instant, DateTime, DateMidnight and MutableDateTime classes. package org.kodejava.joda; import org.joda.time.DateTime; import org.joda.time.Instant; public class InstantDemo { public static void main(String[] args) { // An instant in the datetime continuum […]

Wayan · 2 min read
JODA-TIME / NOTES</>↗
Joda-Time27 Feb 2012

How do I use the Interval class of Joda-Time?

This example show you how to use the org.joda.time.Interval class in Joda-Time. A time interval represents a period of time between two instants. Intervals are inclusive of the start instant and exclusive of the end. The end instant is always greater than or equal to the start instant. package org.kodejava.joda; import org.joda.time.DateTime; import org.joda.time.Duration; import […]

Wayan · 2 min read
CORE API / NOTES</>↗
Core API14 Feb 2012

How do I convert string to Date in GMT timezone?

The following code snippet convert a string representation of a date into a java.util.Date object and the timezone is set to GMT. To parse the string so that the result is in GMT you must set the TimeZone of the DateFormat object into GMT. package org.kodejava.joda; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import […]

Wayan · 1 min read
JODA-TIME / NOTES</>↗
Joda-Time06 Feb 2012

How do I get number of days between two dates in Joda-Time?

The following code snippet show you how to get days between two dates. You can use the Days.daysBetween() method and pass the dates you want to calculate. This method return a Days object. To get the number in days you call the getDays() method. package org.kodejava.joda; import org.joda.time.DateMidnight; import org.joda.time.Days; import org.joda.time.LocalDate; public class DaysBetweenDemo […]

Wayan · 2 min read
✳

Knowledge grows when shared.

Stay curious. There is always something new to learn.

Explore notes ↗
Putu Adi Guna Permana
ABOUT THE AUTHOR

Dr (C). Ir. Putu Adi Guna Permana, S.Kom., M.Kom., IPM., ASEAN Eng.

Writer and founder of Diary Coding — sharing notes, tutorials, and experiences about programming for anyone who wants to keep learning.