Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Jamil Akram   on Jan 12 In Java Category.

  
Question Answered By: Freda Lane   on Jan 12

some parts of this may be useful......

db

private static String getTimeAsAString()
{
Calendar calendar = Calendar.getInstance();
calendar.setTime(today);
StringBuffer buf = new StringBuffer(16);

buf.append(calendar.get(Calendar.DAY_OF_MONTH));
buf.append('/');
buf.append(calendar.get(Calendar.MONTH)+1);
buf.append('/');
buf.append(calendar.get(Calendar.YEAR));
buf.append(' ');
buf.append(calendar.get(Calendar.HOUR_OF_DAY));
buf.append(':');
if(calendar.get(Calendar.MINUTE)<10)
buf.append('0');
buf.append(calendar.get(Calendar.MINUTE));
/*
buf.append(':');
if(calendar.get(Calendar.SECOND)<10)
buf.append('0');
buf.append(calendar.get(Calendar.SECOND));
buf.append(':');
if(calendar.get(Calendar.MILLISECOND)<10)
buf.append('0');
buf.append(calendar.get(Calendar.MILLISECOND));
*/
return buf.toString();
}

Share: 

 

This Question has 2 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on how to get the time of my machine Or get search suggestion and latest updates.


Tagged: