Created
October 22, 2016 06:56
-
-
Save Philip-Nunoo/30530867e4407b09ece18aa31542482e to your computer and use it in GitHub Desktop.
Formatting date of the format yyyy-MM-dd'T'HH:mm:ss.SSSZ
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
package com.code4startups.your.package.name; | |
import java.text.SimpleDateFormat; | |
import java.util.Date; | |
public class Config { | |
public static Date getDateFromStringDate(String dateInString) throws ParseException { | |
Log.e("dd", dateInString); | |
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); | |
return formatter.parse(dateInString.replaceAll("Z$", "+0000")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Integral
try { Date date = Helper.getDateFromStringDate(video.getCreated()); holder.dateCreated.setReferenceTime(date.getTime()); } catch (ParseException e) { e.printStackTrace(); }