Back to project page HorribleSubs-Schedule.
The source code is released under:
Copyright (c) 2014, ?hsan I??k All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: ...
If you think the Android project HorribleSubs-Schedule listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package tr.xip.horriblesubsschedule; //from www . j a v a 2 s . com import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.TimeZone; /** * Created by Hikari on 9/4/14. */ public class Utils { /** * Converts UTC-7 to local time * @param time original release time * @return */ public static String convertAnimeReleaseTimeToLocal(String time) { String[] timeParts = time.split(":"); long timestamp; Calendar calendar = Calendar.getInstance(); TimeZone timeZone = calendar.getTimeZone(); calendar.set(Calendar.HOUR_OF_DAY, Integer.parseInt(timeParts[0]) + 7 // +7 to make the time UTC (from UTC-7, obviously) + (timeZone.getOffset(new Date().getTime()) / 1000 / 60 / 60)); // Add time difference calendar.set(Calendar.MINUTE, Integer.parseInt(timeParts[1])); SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); sdf.setTimeZone(timeZone); return sdf.format(calendar.getTime()); } }