Ruang penulis
SEBUAH JURNAL TENTANG TEKNOLOGI

Belajar hal baru.
Tulis. Bagikan.

Ruang untuk merangkai pengetahuan, satu baris kode setiap hari.
Temukan tutorial, ide, dan catatan dari perjalanan belajar.

1914 catatan & terus bertumbuh
PILIHAN EDITOR
Java

Memahami Java Stream: olah koleksi dengan lebih ringkas

Pelajari alur filter, map, dan collect untuk mengolah data Java dengan kode yang mudah dibaca.

D Tim Diary Coding · 1 menit baca
UNTUK RASA INGIN TAHUMU

Catatan terbaru.

CORE API / CATATAN</>
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 menit baca
JODA-TIME / CATATAN</>
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 menit baca
JODA-TIME / CATATAN</>
Joda-Time06 Feb 2012

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

The code below show you how to use the Months class to calculate the different in months between two dates. package org.kodejava.joda; import org.joda.time.DateMidnight; import org.joda.time.LocalDate; import org.joda.time.Months; import java.util.Date; public class MonthsBetweenDemo { public static void main(String[] args) { // Creates an instance of start and end dates. DateMidnight start = new DateMidnight("2021-01-01"); DateMidnight […]

Wayan · 2 menit baca
JODA-TIME / CATATAN</>
Joda-Time02 Feb 2012

How do I convert Joda-Time’s DateTime into Calendar or Date object?

This code snippet show you how to convert Joda-Time’s DateTime object into JDK’s java.util.Calendar or java.util.Date object. To convert DateTime to java.util.Date we use the toDate() method and to convert to java.util.Calendar we use the toCalendar() method. package org.kodejava.joda; import org.joda.time.DateTime; import java.util.Calendar; import java.util.Date; import java.util.Locale; public class DateTimeToDateCalendarDemo { public static void main(String[] […]

Wayan · 2 menit baca
JODA-TIME / CATATAN</>
Joda-Time02 Feb 2012

How do I do a date calculations in Joda-Time?

Using the Joda-Time library can simplify the date calculation process. For instance, we can add or subtract some days, weeks, months or year easily. There are a plus and minus method for this operation. For instance if you want to add 9 weeks to date object you can do something like date.plusWeeks(9). package org.kodejava.joda; import […]

Wayan · 2 menit baca
JODA-TIME / CATATAN</>
Joda-Time02 Feb 2012

How do I format DateTime object in Joda-Time?

The example show you how to format the string representation of a date. In Joda we can use the DateTime‘s class toString() method. The method accept the pattern of the date format and the locale information. package org.kodejava.joda; import org.joda.time.DateTime; import org.joda.time.format.DateTimeFormat; import java.util.Locale; public class FormattingDemo { // Define the date format pattern. private […]

Wayan · 2 menit baca

Pengetahuan tumbuh ketika dibagikan.

Simpan rasa ingin tahu. Selalu ada hal baru untuk dipelajari.

Jelajahi catatan ↗
Putu Adi Guna Permana
TENTANG PENULIS

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

Penulis dan pendiri Diary Coding — berbagi catatan, tutorial, dan pengalaman seputar pemrograman untuk siapa pun yang ingin terus belajar.