The usual way we solve this is to ask for samples. Give us the inputs that you have and the outputs you would desire. If there are exceptions in the likely inputs or outputs, specify those. Since you didn't actually give us a reason WHY you wanted this or in what context, all we can do is guess. HOWEVER... if your 12 digits are date/time related (yymmddhhnnss format, for example), there might be a few ways to do this that are logically easy to understand without having to parse out text.