private static String getTimeForApi ( Date dt ) { Calendar calendar = new GregorianCalendar ( ) ; TimeZone timeZone = calendar . getTimeZone ( ) ; Calendar cal = Calendar . getInstance ( timeZone ) ; cal . setTime ( dt ) ; return String . format ( "%tFT%<tRZ" , cal ) ; }
Format date the way Github api wants