Java Function for %%xxxx%% translation
Hi,
When using a Put-Context-Var activity in a process flow, it is possible to
use patterns to specify date and time values. For example, I can set the
variable value to "File_%%yyyyMMdd%%.txt". When the flow executes, the
context variable will be assigned the text "File_20120411.txt".
Is there a way to do this same thing from a plugin? I need a plugin to take
the string "File_%%yyyyMMdd%%.txt" and convert it to the string
"File_20120411.txt". (The actual string to convert will vary from execution
to execution-I'll be pulling it from a database table.)
-
To achieve your scenario we request you to use the following Java Custom Code.
import java.text.*;
import java.util.*;Date dateTime = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
String dateTimeString = sdf.format(dateTime);
System.out.println(dateTimeString);0
Please sign in to leave a comment.
Comments
1 comment