Skip to Content
author's profile photo Former Member
Former Member

hardcoded DATE as input for RFC

Dear all,i haf the following codes

SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");

input1.setIv_Pdatu(formatter.format (new java.sql.Date(System.currentTimeMillis())));

but it seems the system return error,it said tat my setlv_Pdatu required DATE input but not STRING..how should i solve this? pls advice,thank you

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Oct 08, 2007 at 09:13 AM

    Hi Joan,

    input1.setIv_Pdatu(Date.valueOf(formatter.format (new java.sql.Date(System.currentTimeMillis()))));

    Regards,

    Murtuza

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Joan,

      Try this.

      import java.sql.Date;

      try {

      Date current_Date = new Date(System.currentTimeMillis());

      input1.setIv_Pdatu(new Date(formatter.parse(current_Date.toString()).getTime()));

      } catch (ParseException e1) {

      // TODO Auto-generated catch block

      wdComponentAPI.getMessageManager().reportSuccess("Error : "+e1.getMessage());

      }

      Regards,

      Mithu

  • author's profile photo Former Member
    Former Member
    Posted on Oct 08, 2007 at 09:15 AM

    HI

    By Default every Node Attribute which you create will be of <b>STRING</b> type. so you need Change the <i>setlv_Pdatu</i> to <b>date</b> . is this the problem

    Regards

    Chaitanya.A

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Joan,

      Check this code to convert string to date.

      SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");

      String str_date = "20071009";

      java.util.Date util_date= formatter.parse(str_date);

      java.sql.Date dt = new java.sql.Date(util_date.getTime());

      input1.setIv_Pdatu(dt);

      /message/1212686#1212686 [original link is broken]

      Regards,

      Mithu

  • author's profile photo Former Member
    Former Member
    Posted on Oct 08, 2007 at 10:07 AM

    Hi

    try to use this

    SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");

    java.sql.Date dt=(java.sql.Date)new java.util.Date();

    input1.setIv_Pdatu(formatter.format (dt));

    Regards

    Abhijith YS

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 08, 2007 at 02:27 PM

    Hi Joan,

    Try this:

    Calendar cal = Calendar.getInstance();
    input1.setIv_Pdatu(cal.getTime());

    Regards,

    Omri

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 09, 2007 at 03:27 AM

    Hi

    <b>import java.util.GregorianCalendar;</b>

    java.sql.Date formatter = new java.sql.Date(gregorianCalendar.getTimeInMillis());

    wdContext.input1().setIv_Pdatu(formatter);

    Regards

    Chaitanya.A

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.