Hi ,
i would like to convert the date that i retrieve with the widget to this format YYYY/mm/dd and then save it into mysql database
Regards
Hi ,
i would like to convert the date that i retrieve with the widget to this format YYYY/mm/dd and then save it into mysql database
Regards
First, you are probably using Java 8 - in which case drop the java.util.date and use the new java.time imports. Much better for date and time manipulation.
See here for more information:
http://www.oracle.com/technetwork/articles/java/jf14-date-time-2125367.html
http://www.vogella.com/tutorials/JavaDateTimeAPI/article.html
Here you can then use DateTimeFormatter.ofPattern(âYYYY/MM/DDâ) construct.
I wouldnât do the conversion in the form, but only in the process stream before the update to the database using a service task (or the task output operation). Or in the SQL statement itself, such as
INSERT INTO custorder VALUES (âKevinâ,âyesâ, STR_TO_DATE(â1-01-2012â, â%d-%m-%Yâ));
This is fro PHP so change the formats and variables as necessaryâŠ
regards
I have created this code:
`import java.text.SimpleDateFormat;
import java.util.Date;
public class exemple {
public static void main(String[ ] arg) {
java.util.Date date = ${date_local};
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String format = formatter.format(date);
System.out.println(format);
}
}`
Then what i want to do is retrieve the date that the user has selected and then convert its format from this Mon Oct 05 21:11:32 2015 or this DD/MM/YYYY to this YYYY/MM/DD.
i donât know where i can put this code into my workflow in order to do it .
Iâm doing this because i need the dates with this format :yyyy/mm/dd , in order to put in a insert query , because my database use this format
regards
Somebody has any idea?
i have created this mysql query , but didnât work:
INSERT INTO it
.documentation
(âjamesâ,âaâ,âbâ, STR_TO_DATE(â${fecha}â,â%Y-%m-%dâ)
where i have the wrong?
I think that the wrong is in variable ${fecha}.
i have reviewed the variable that contain the date, that the user has selected, and i see that it saved with this format : 1 de octubre de 2015., this is the reason that why didnât work.
I have changed this format ,but when i execute the process , the format is the same, and finally it didnât work the insert query .
Have you tried a hardcoded version of the insert first, with a real date? Try that. Then work on the Bonita version. Use the MySQL Workbench to prove that the SQL works.
I have tried the insert query with workbench and it worked well .
as yo i say in the previous post , the problem is with the variable that are there in the insert query , because i can see that its value is : 10 octoberâŠetc , and not is 2015-01-01 , for example.
so âŠ
How i can change the format of date variable .?
Tengo el mismo problema alguien lo resolvio?