JODA-TIME / CATATAN</>↗Joda-Time02 Feb 2012
In Joda-Time the date and time information are divided into fields. The following example show you some fields that can be obtained from the DateTime object. For example to get the day of the year we use the getDayOfYear() method and to get the day of week we can use the getDayOfWeek() method. package org.kodejava.joda; […]
JODA-TIME / CATATAN</>↗Joda-Time02 Feb 2012
This example will give you the first day of the next month from the current system date. In the example we use the MutableDateTime class. MutableDateTime is a datetime class whose value can be modified. In the code snippet we start by creating an instance of MutableDateTime class. We add 1 month from the current […]
JODA-TIME / CATATAN</>↗Joda-Time02 Feb 2012
This example show us how to use Joda-Time’s DateTime class to get the last day of the month. To get the last day of the month we first need to find out the last date of the month. To do this, create a new instance of a DateTime. From the DateTime object get the day-of-the-month […]
JODA-TIME / CATATAN</>↗Joda-Time01 Feb 2012
The following example show you a various way to create an instance of Joda-Time’s DateTime class. By using the default constructor we will create an object with the current system date time. We can also create the object by passing the information like year, month, day, hour, minutes and second. Joda can also use an […]
JODA-TIME / CATATAN</>↗Joda-Time01 Feb 2012
The org.joda.time.DateMidnight class represent a date time information with the time value set to midnight. The following snippet show you how to instantiate this class. package org.kodejava.joda; import org.joda.time.DateMidnight; import org.joda.time.format.DateTimeFormat; public class DateMidnightDemo { public static void main(String[] args) { // Create DateMidnight object of the current system date. DateMidnight date = new DateMidnight(); […]
CORE API / CATATAN</>↗Core API16 Jan 2012
This code snippet show you how to create an array of unique numbers from another array of numbers. package org.kodejava.lang; import java.util.Arrays; public class UniqueArray { /** * Return true if num appeared only once in the array. */ public static boolean isUnique(int[] numbers, int num) { for (int number : numbers) { if (number […]