1 Reply Latest reply: Jul 11, 2012 12:07 PM by 947051 RSS

    Getting Date for an activity

    947051
      What is the correct code in java for getting Date for an Activity update in the "mm/dd/yyyy <Time>" format in webservices2.0 . I am using

      result.getCreatedDate().getTime()

      but this is giving me: time in following format:

      Thu Mar 15 12:23:11 MDT 2012
        • 1. Re: Getting Date for an activity
          947051
          OK fixed it using the SimpleDateFormat class in Java.util

          String DATE_FORMAT1 = "MM/dd/YYYY HH:mm:ss";//Give the format you want the date in Eg. 03/15/2012 14:17:02
          String DATE_FORMAT2 = "MM/dd/YYYY hh:mm:ss a";//Give the format you want the date in Eg. 03/15/2012 2:17:02 PM
          String DATE_FORMAT3 = "E yyyy.MM.dd hh:mm:ss a zzz";//Give the format you want the date in Eg. Fri 2011.10.21 04:59:33 PM MDT
          SimpleDateFormat dateFormatter = new SimpleDateFormat(DATE_FORMAT1);// To format the date returned by CRM-OD
          .
          .
          .
          .
          .
          System.out.println(dateFormatter.format(result.getCompletedDatetime().getTime()));