Created
January 23, 2009 21:09
-
-
Save brianm/51199 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 org.testng.annotations.Test; | |
import static org.testng.Assert.assertEquals; | |
public class TestDateParse | |
{ | |
@Test | |
public void testFoo() throws Exception { | |
String d = "13/Feb/2008:15:33:39 -0800"; | |
DateTimeFormatter dtf = DateTimeFormat.forPattern("dd/MMM/yyyy:HH:mm:ss Z"); | |
DateTime dt = dtf.parseDateTime(d); | |
assertTrue(new DateTime(2008, 2, 13, 15, 33, 39, 0, DateTimeZone.forOffsetHours(-8)).isEqual(dt)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment