Saturday 15 May 2010

java - How to generate series of ascending number that include date element? -


Hello I want to create a function that produces ascending numbers. For example, if today's date is June 21, 2013, the number will be 130621001.
The last three digit numbers are ascending, and it will reset it back to 001 on each date.
How can I know about making date points, but I'm stuck with those last three digits.

Thank you in advance.

Try it, good luck

  public static string next number (string) Current number) {// value yymmddnnn string sDateNum = currentNumber.substring (0, 6); String sCurrentNum = currentNumber.substring (6 9); Int i = integer.valof ("1" + sCurrentNum); I ++; Return sDateNum + String.valueOf (i) .substring (1, 4); } System.out.println (NextNumber ("130621001"));    

No comments:

Post a Comment