hi! i was doing wondering if there's a way to print out & increment 3-digit-serial no.?
i was planning to print out an invoice.
i want the starting of the invoice to be in this format YYYYMMDDNNN (where YYYY is the year, MM is month, DD is date & NNN is serial no (e.g: 001, 002, 003....) )
i've did the Year, month and date already. but when i want to print out the serial no. , it shows "1, 2 ..." instead of "001, 002"..
can someone help me?
this is the code i did so far.
i was planning to print out an invoice.
i want the starting of the invoice to be in this format YYYYMMDDNNN (where YYYY is the year, MM is month, DD is date & NNN is serial no (e.g: 001, 002, 003....) )
i've did the Year, month and date already. but when i want to print out the serial no. , it shows "1, 2 ..." instead of "001, 002"..
can someone help me?
this is the code i did so far.
Code:
package JPRG;
import java.util.Calendar;
public class ShoppingTransactionRecord {
public static void main (String args[]){
int serialNo = 000;
Calendar cal = Calendar.getInstance();
int date = cal.get(Calendar.DATE);
int month = cal.get(Calendar.MONTH) + 1;
int year = cal.get(Calendar.YEAR);
for (int i=0;i<10;i++){
serialNo++;
System.out.println("Testing =====> " + year + month + date + serialNo);
}
}
}
Comment