Code example for Time

Methods: format3339, setToNow

0
    			String.format("%02d", cal.get(Calendar.DAY_OF_MONTH));
    	Log.d("HAL","Date:"+date);
        return date;
    } 
    static public String timeToShortString(Time t) {
    	String cad=t.format3339(false);
    	//String cad = String.format("%4d%02d%02dT%02d%02d%02dZ",  
    	//		t.year,t.month,t.monthDay,t.hour,t.minute,t.second); 
    	return cad;
    } 
    static public String locToString(Location loc) {
    	Log.i("HAL","Halib.locToString()");
    	String cad ="";
    	long t = loc.getTime();
    	cad += dateToString(t,true);
    	cad += ","+timeToString(t,true);
    	String pp = String.format("%.6f", loc.getLongitude()).replace(',', '.');
    	cad+=","+pp;
    	pp = String.format("%.6f", loc.getLatitude()).replace(',', '.');
    	cad+=","+pp;
    	pp = String.format("%.6f", loc.getAltitude()).replace(',', '.');
    	cad+=","+pp;
    	double vkmh=loc.getSpeed()*3.6;
    	pp = String.format("%.6f", vkmh).replace(',', '.');
    	cad+=","+pp;
    	pp = String.format("%.6f", loc.getBearing()).replace(',', '.');
    	cad+=","+pp;
    	pp=String.format("%.1f", loc.getAccuracy()).replace(',', '.');
    	cad+=","+pp;
    	//Log.i("HAL","   Halib: loc= "+cad); 
    	return cad;
    } 
    static public String locToShortString(Location loc) {
    	String cad ="";
    	Time t = new Time();
    	t.setToNow();
    	cad += timeToShortString(t);
    	String pp = String.format("%.3f", loc.getLongitude()).replace(',', '.');
    	cad+=","+pp;
    	pp = String.format("%.3f", loc.getLatitude()).replace(',', '.');
    	cad+=","+pp;