Skip to content

Commit

Permalink
updated libs
Browse files Browse the repository at this point in the history
  • Loading branch information
WareNinja committed Aug 3, 2016
1 parent c7a4bbd commit c750d28
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
target/*
bin/*

/target/
11 changes: 6 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>strtotime-for-java</groupId>
<artifactId>strtotime-for-java</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>0.0.3-SNAPSHOT</version>
<name>strtotime-for-java</name>
<description>strtotime Java library</description>
<build>
Expand All @@ -19,23 +19,24 @@
</plugins>
</build>
<dependencies>
<!--
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<!--
-->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.2.1</version>
<version>3.4</version>
</dependency>
-->

</dependencies>
<developers>
<developer>
<id>WareNinja</id>
<name>Incognito Ninja</name>
<name>incognito</name>
<email>yg@wareninja.com</email>
</developer>
</developers>
Expand Down
21 changes: 20 additions & 1 deletion src/ExampleUsage.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
*/


import java.sql.Date;
import java.text.SimpleDateFormat;
import java.util.Locale;
import java.util.TimeZone;

import com.wareninja.opensource.strtotime.MyUtils;
import com.wareninja.opensource.strtotime.Str2Time;

Expand Down Expand Up @@ -44,8 +49,22 @@ public static void main(String[] args) {
System.out.println("+2 weeks -> " + MyUtils.getFormattedDate( Str2Time.convert("2 weeks") ));
System.out.println("-4 weeks -> " + MyUtils.getFormattedDate( Str2Time.convert("-4 weeks") ));
System.out.println("Mon Sep 24 03:35:21 +0000 2012 -> " + MyUtils.getFormattedDate( Str2Time.convert("Mon Sep 24 03:35:21 +0000 2012") ));
System.out.println("2014-03-04T08:45:17.315-05:00 -> " + MyUtils.getFormattedDate( Str2Time.convert("2014-03-04T08:45:17.315-05:00") ));


/*
String[] formats = new String[] {
"yyyy-MM-dd HH:mm:ss.SSSZ",
"yyyy-MM-dd'T'HH:mm:ss.SSSZ",
"yyyy-MM-dd'T'HH:mm:ss.SSSZZZ",
"yyyy-MM-dd'T'HH:mm:ss.SSS ZZZZZ",
};
for (String format : formats) {
SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.US);
System.out.format("%30s %s\n", format, sdf.format(new Date(System.currentTimeMillis())));
//sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
//System.out.format("%30s %s\n", format, sdf.format(new Date(System.currentTimeMillis())));
}
*/
}

}
4 changes: 2 additions & 2 deletions src/com/wareninja/opensource/strtotime/DaysMatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import java.util.Date;
import java.util.regex.Pattern;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;

class DaysMatcher implements Matcher {

Expand Down
4 changes: 2 additions & 2 deletions src/com/wareninja/opensource/strtotime/MinutesMatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import java.util.Date;
import java.util.regex.Pattern;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;

class MinutesMatcher implements Matcher {

Expand Down
2 changes: 1 addition & 1 deletion src/com/wareninja/opensource/strtotime/MyUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import java.util.Locale;
import java.util.TimeZone;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;

public class MyUtils {

Expand Down
5 changes: 3 additions & 2 deletions src/com/wareninja/opensource/strtotime/Str2Time.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ public final class Str2Time {
matchers.add(new DateFormatMatcher(new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss")));// e.g. Mon, 03 Dec 2012 20:00:00
matchers.add(new DateFormatMatcher(new SimpleDateFormat("yyyy MM dd")));
matchers.add(new DateFormatMatcher(new SimpleDateFormat("EEE MMM d HH:mm:ss Z yyyy"))); // format used by TWITTER! e.g. "Mon Sep 24 03:35:21 +0000 2012"

// NOTE: you can add more custom matchers as you like!!!
matchers.add(new DateFormatMatcher(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ"))); // format used by DISCOURSE! e.g. "2014-03-04T08:45:17.315-05:00"

// NOTE: you can add more custom matchers as you need!!!
}

public static void registerMatcher(Matcher matcher) {
Expand Down
4 changes: 2 additions & 2 deletions src/com/wareninja/opensource/strtotime/WeeksMatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import java.util.Date;
import java.util.regex.Pattern;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;

class WeeksMatcher implements Matcher {

Expand Down

0 comments on commit c750d28

Please sign in to comment.