Skip to content

Instantly share code, notes, and snippets.

@Philip-Nunoo
Created October 22, 2016 06:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Philip-Nunoo/30530867e4407b09ece18aa31542482e to your computer and use it in GitHub Desktop.
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
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"));
}
}
@Philip-Nunoo
Copy link
Author

@Integral
try { Date date = Helper.getDateFromStringDate(video.getCreated()); holder.dateCreated.setReferenceTime(date.getTime()); } catch (ParseException e) { e.printStackTrace(); }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment