Topic
6 replies Latest Post - ‏2010-11-08T15:48:38Z by bosox
GeorgeMuhammad
GeorgeMuhammad
9 Posts
ACCEPTED ANSWER

Pinned topic Date translation

‏2010-10-18T15:40:45Z |
how do I translate WPF date (yyyy-MM-dd) to db2 date (yyyyMMdd). I need to remove the dashes. Using a dojo date builder.
Updated on 2010-11-08T15:48:38Z at 2010-11-08T15:48:38Z by bosox
  • GeorgeMuhammad
    GeorgeMuhammad
    9 Posts
    ACCEPTED ANSWER

    Re: Date translation

    ‏2010-10-18T17:46:00Z  in response to GeorgeMuhammad
    my solution:
    1. created method builder with the following code:
    {
    //get Dojo Date/Time Picker values
    String item = webAppAccess.getRequestInputs().getInputValue("start_date");
    String item2 = webAppAccess.getRequestInputs().getInputValue("end_date");

    // Replace any character that's not a number and set startdate/enddate variables
    String value = item.replaceAll("\\D", "");
    webAppAccess.getVariables().setString("startdate",value);
    String value2 = item2.replaceAll("\\D", "");
    webAppAccess.getVariables().setString("enddate",value2);
    }
    • bosox
      bosox
      64 Posts
      ACCEPTED ANSWER

      Re: Date translation

      ‏2010-10-18T18:54:58Z  in response to GeorgeMuhammad
      You can also use the Date Time Formatter builder if you find any issues with your solution.
      The Date Time Formatter will take a value for the format that the back end uses (this is the parser value) and then a format that you want to use for display. There are some acticels on the wiki including at least one sample.
      http://www-10.lotus.com/ldd/pfwiki.nsf/xpViewRecent.xsp?searchValue=date%20format
      http://www-10.lotus.com/ldd/pfwiki.nsf/dx/ibm-date-time-formatting
    • bosox
      bosox
      64 Posts
      ACCEPTED ANSWER

      Re: Date translation

      ‏2010-10-18T18:55:11Z  in response to GeorgeMuhammad
      You can also use the Date Time Formatter builder if you find any issues with your solution.
      The Date Time Formatter will take a value for the format that the back end uses (this is the parser value) and then a format that you want to use for display. There are some acticels on the wiki including at least one sample.
      http://www-10.lotus.com/ldd/pfwiki.nsf/xpViewRecent.xsp?searchValue=date%20format
      http://www-10.lotus.com/ldd/pfwiki.nsf/dx/ibm-date-time-formatting
  • bosox
    bosox
    64 Posts
    ACCEPTED ANSWER

    Re: Date translation

    ‏2010-10-18T18:56:12Z  in response to GeorgeMuhammad
    You can use the Date Time Formatter builder. The Date Time Formatter will take a value for the format that the back end uses (this is the parser value) and then a format that you want to use for display. There are some acticels on the wiki including at least one sample.
    http://www-10.lotus.com/ldd/pfwiki.nsf/xpViewRecent.xsp?searchValue=date%20format
    http://www-10.lotus.com/ldd/pfwiki.nsf/dx/ibm-date-time-formatting
  • GeorgeMuhammad
    GeorgeMuhammad
    9 Posts
    ACCEPTED ANSWER

    Re: Date translation

    ‏2010-10-28T15:57:55Z  in response to GeorgeMuhammad
    Thanks for the reply. The formatters work great for dates in the UI, however they did not help me taking the date from the UI and formatting for a SQL call.
    • bosox
      bosox
      64 Posts
      ACCEPTED ANSWER

      Re: Date translation

      ‏2010-11-08T15:48:38Z  in response to GeorgeMuhammad
      Hi George,

      If you're looking to go from an input field to a back end, you can use a Data Field Modifier. In the formatting section of the builder, find the formatter calss input and select "com.bowstreet.builders.webapp.pageautomation.StandardFormatter".

      Then in the Translate Expression field select "Translate(Data$Display)".
      In the Translate Exp Arugment field, enter the format you want for your data and the format the user will enter in the display separated by a $. For example, enter MM-dd-yyyy$MMM dd, yyyy