Skip to content

Instantly share code, notes, and snippets.

@erfanegtfi
Created April 13, 2018 12:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erfanegtfi/8e0eacfcf79793deb7b0be402616538f to your computer and use it in GitHub Desktop.
Save erfanegtfi/8e0eacfcf79793deb7b0be402616538f to your computer and use it in GitHub Desktop.
convert Minute To Hour
public static void convertMinuteToHour(int totalMinute, TextView textView) {
if (totalMinute >= 60) {
int hours = (int) Math.floor((double) (totalMinute / 60));
totalMinute %= 60;
if (totalMinute == 0) {
textView.setText("طول بازدید: " + persianNumbers(String.valueOf(hours)) + " ساعت ");
return;
} else {
textView.setText("طول بازدید: " + persianNumbers(String.valueOf(hours)) + " ساعت و " + persianNumbers(String.valueOf(totalMinute)) + " دقیقه ");
return;
}
}
textView.setText("طول بازدید: " + persianNumbers(String.valueOf(totalMinute)) + " دقیقه ");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment