java - How to generate a file with current Day's hour with minute upto current time using Calendar -



java - How to generate a file with current Day's hour with minute upto current time using Calendar -

how generate file current day's hr min upto current time.using calendar in java

for illustration if time 02:28, want hr , min below.

output: 00:00 00:01 00:02 00:03 . . . . 02:28

try code:

filewriter filewriter = new filewriter("myfile"); calendar = new gregoriancalendar(); calendar c = new gregoriancalendar(); c.set(calendar.hour_of_day, 0); c.set(calendar.minute, 0); dateformat df = new simpledateformat("hh:mm"); while (c.before(now)) { c.add(calendar.minute, 1); filewriter.write(df.format(c.gettime())+system.lineseparator()); } filewriter.close();

java calendar

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -