Today i have written a program to convert seconds into hours, minutes and seconds in java. Any one can easily understand this program and implement in their web application without any difficulties. Definitely it is more usefull for those who are working on date/time related functionalites. Lets start understanding the example carefully.
package Examples; public class ConvertSeconds2Time { public static String getFormattedTimeString(long timeInSeconds) { String timeStr = new String(); long sec_term = 1; long min_term = 60 * sec_term; long hour_term = 60 * min_term; long result = Math.abs(timeInSeconds); int hour = (int) (result / hour_term); result = result % hour_term; int min = (int) (result / min_term); result = result % min_term; int sec = (int) (result / sec_term); if (timeInSeconds < 0) { timeStr = "-"; } if (hour > 0) { timeStr += hour + "h "; } if (min > 0) { timeStr += min + "m "; } if (sec > 0) { timeStr += sec + "s "; } return timeStr; } public static void main(String args[]){ System.out.println(getFormattedTimeString(64000)); } }
Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Java developer learn from Java Training in Chennai. or learn thru Java Online Training in India . Nowadays Java has tons of job opportunities on various vertical industry.
ReplyDeleteGreat Article
DeleteIEEE Final Year Projects for CSE
IEEE Project Centers in Chennai
pond coin hangi borsada
ReplyDeleteslp coin hangi borsada
enjin coin hangi borsada
mina coin hangi borsada
sngls coin hangi borsada
win coin hangi borsada
shiba coin hangi borsada
is binance safe
is binance safe
tiktok jeton hilesi
ReplyDeletetiktok jeton hilesi
referans kimliği nedir
gate güvenilir mi
tiktok jeton hilesi
paribu
btcturk
bitcoin nasıl alınır
yurtdışı kargo
Cool you write, the information is very good and interesting, I'll give you a link to my site. 900 seconds into minutes
ReplyDeleteI use basically superior fabrics : you will discover these products by: 900 seconds into minutes
ReplyDeleteseo fiyatları
ReplyDeletesaç ekimi
dedektör
instagram takipçi satın al
ankara evden eve nakliyat
fantezi iç giyim
sosyal medya yönetimi
mobil ödeme bozdurma
kripto para nasıl alınır
instagram beğeni satın al
ReplyDeleteyurtdışı kargo
seo fiyatları
saç ekimi
dedektör
fantazi iç giyim
sosyal medya yönetimi
farmasi üyelik
mobil ödeme bozdurma
bitcoin nasıl alınır
ReplyDeletetiktok jeton hilesi
youtube abone satın al
gate io güvenilir mi
referans kimliği nedir
tiktok takipçi satın al
bitcoin nasıl alınır
mobil ödeme bozdurma
mobil ödeme bozdurma