1 package com.nwalsh.saxon; 2 3 import java.io.*; 4 import java.util.Calendar ; 5 import java.util.GregorianCalendar ; 6 import java.util.Date ; 7 import java.util.Locale ; 8 import java.util.TimeZone ; 9 import java.text.DateFormat ; 10 import java.text.ParseException ; 11 12 43 public class CVS { 44 49 public CVS() { 50 } 51 52 59 public static String localTime (String cvsDate) { 60 if (!cvsDate.startsWith("$Date: ")) { 62 return cvsDate; 63 } 64 65 String yrS = cvsDate.substring(7,11); 66 String moS = cvsDate.substring(12,14); 67 String daS = cvsDate.substring(15,17); 68 String hrS = cvsDate.substring(18,20); 69 String miS = cvsDate.substring(21,23); 70 String seS = cvsDate.substring(24,26); 71 72 TimeZone tz = TimeZone.getTimeZone("GMT+0"); 73 GregorianCalendar gmtCal = new GregorianCalendar (tz); 74 75 try { 76 gmtCal.set(Integer.parseInt(yrS), 77 Integer.parseInt(moS)-1, 78 Integer.parseInt(daS), 79 Integer.parseInt(hrS), 80 Integer.parseInt(miS), 81 Integer.parseInt(seS)); 82 } catch (NumberFormatException e) { 83 } 85 86 Date d = gmtCal.getTime(); 87 88 return d.toString(); 89 } 90 } 91 | Popular Tags |