PowenKo, Android Tutorial 095-1, System, Time, get current time, date

November 19, 2011   ·   0 Comments

Calendar cal=Calendar.getInstance();
String tY=String.valueOf(cal.get(Calendar.YEAR));
String tM=String.valueOf(cal.get(Calendar.MONTH));
	if (tM.length()<2){ tM="0"+tM;  }
String tD=String.valueOf(cal.get(Calendar.DATE));
	if (tD.length()<2){ tD="0"+tD;  }
String tH=String.valueOf(cal.get(Calendar.HOUR_OF_DAY));
	if (tH.length()<2){ tH="0"+tH;  }
String tMin=String.valueOf(cal.get(Calendar.MINUTE));
        if (tMin.length()<2){ tMin="0"+tMin;  }
String t_allCurrentTime=tY+tM+tD+tH+tMin;
shareShare on FacebookShare on Google+Share on LinkedInEmail this to someonePrint this pageBuffer this pageDigg thisFlattr the authorShare on RedditPin on PinterestShare on StumbleUponShare on TumblrTweet about this on Twitter

By


Readers Comments (0)


You must be logged in to post a comment.

PowenKo’s Online Store

powenko_arduinoBook
Android7

Amazon

adsbygoogle

Recent Posts

Categories

Amazon