Created
December 29, 2015 02:45
-
-
Save ainvyu/1bc127164eab153f6498 to your computer and use it in GitHub Desktop.
Date sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.joda.time.DateTime; | |
import org.joda.time.DateTimeZone; | |
import org.joda.time.format.DateTimeFormat; | |
import org.joda.time.format.DateTimeFormatter; | |
import java.util.ArrayList; | |
import java.util.List; | |
/** | |
* Created by vine on 15. 5. 27.. | |
*/ | |
public class Main { | |
public static void main(String args[]) { | |
String pattern = "yyyyMMdd"; | |
String thisTimeZone = DateTimeZone.UTC.getID(); //"UTC"; | |
DateTimeFormatter formatter = DateTimeFormat.forPattern(pattern) | |
.withZone(DateTimeZone.forID(thisTimeZone)); | |
DateTime dateTime = formatter.parseDateTime("20160101"); | |
List<String> days = new ArrayList<String>(); | |
for (int i = 0; i < 30; ++i) { | |
days.add(formatter.print(dateTime)); | |
dateTime = dateTime.plusDays(1); | |
} | |
System.out.println(days); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment