Add collaboration feature
[sdc.git] / openecomp-be / lib / openecomp-sdc-vendor-license-lib / openecomp-sdc-vendor-license-api / src / main / java / org / openecomp / sdc / vendorlicense / VendorLicenseUtil.java
1 package org.openecomp.sdc.vendorlicense;
2
3 import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
4
5 import java.text.ParseException;
6 import java.text.SimpleDateFormat;
7
8 public class VendorLicenseUtil {
9
10   private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
11
12   public static String getIsoFormatDate(String inputDate) {
13     mdcDataDebugMessage.debugEntryMessage("inputDate date", inputDate);
14     String isoFormatDate = null;
15     SimpleDateFormat isoDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
16     SimpleDateFormat inputDateFormat = new SimpleDateFormat("MM/dd/yyyy'T'HH:mm:ss'Z'");
17
18     try {
19       isoFormatDate = isoDateFormat.format(inputDateFormat.parse(inputDate));
20     } catch (ParseException e) {
21       mdcDataDebugMessage.debugExitMessage("parsing error", isoFormatDate);
22       isoFormatDate = null;
23     }
24
25     mdcDataDebugMessage.debugExitMessage("formatted date", isoFormatDate);
26     return isoFormatDate;
27   }
28 }