Code example for SimpleDateFormat

Methods: format

0
	@Override 
	public void onReceive(Context context, Intent intent) {
		 
         //You can do the processing here update the widget/remote views. 
         StringBuilder msgStr = new StringBuilder("Current time : ");
         Format formatter = new SimpleDateFormat("hh:mm:ss a");
         msgStr.append(formatter.format(new Date()));
         Toast.makeText(context, msgStr, Toast.LENGTH_SHORT).show();
	} 
} 
Contextual code suggestions in your IDE  Get Codota for Java