OSB Supported Date format ( YYYY-MM-DDTHH:MM:SS[+/-]hh:mm)

Hi,
Can you pls help me in understanding, whether this date format is supported in OSB YYYY-MM-DDTHH:MM:SS[+/-]hh:mm, is there any datatype need to be used for this requirement. Source application is sending the date in the above specified date format. Please advice on this. what is requird in OSB to pass it to end system.
Thanks.

HI,
yes it is working with datetime data type.
Thank you..

Similar Messages

  • How to validate date formate YYYY-MM-DDThh:mm:ss ?

    i have implemented validation for YYYY-MM-DD <br>
    but how to validate for time <br>
    here is the code for date validation
    could you please anyone help me on this issue
    <br><br><br> public static boolean validateDateFormate(String date) <br><br>
    {   <br>
    <br>      try {   <br>          
    <br>     String dateFormat="yyyy-MM-ddYYYY-MM-DDThh:mm:ss";
    <br>     String temp = date.substring(0,date.indexOf("-"));
    <br>     if(temp.length()!= 4)
    <br>          return false;           
    <br>     SimpleDateFormat df=new SimpleDateFormat(dateFormat);      
    <br>     Date date1=df.parse(date);
         <br>String resultDateString=df.format(date1);
         <br>System.out.println("date1"+resultDateString);
         <br> if ( !date.equals(resultDateString)) { return false;  }
    <br>     } catch (Exception de) {
         <br>     System.out.println(de);
    <br>          return false;
         <br>     
         <br>}
    <br>     return true;
    <br> }

    A useful Data util class
    import java.text.DateFormat;
    import java.util.Calendar;
    import java.util.Date;
    import java.util.StringTokenizer;
    public final class SlacDate implements Comparable
         public final static int FormatDDMMCCYY               = 0;
         public final static int FormatMMDDCCYY               = 1;
         public final static int FormatDATETIME               = 2;
         public final static int FormatMMMDDTIME               = 3;
         public final static int FormatTIMESTAMP               = 4;
         public final static int FormatCCYYMMDD               = 5;
         public final static int FormatCCYYMMDDHHMM          = 6;
         public final static int FormatCCYYMMDDHHMMSS     = 7;
         public final static int FormatDDMMCCYYTIME          = 8;
         public final static int FormatDATEVERBOSE          = 9;
         public final static int FormatDATETIMEVERBOSE     = 10;
         public final static int FormatHHMMSS               = 11;
         public final static int FormatHHMMSSMIL               = 12;
         public final static int FormatDB2TIMESTAMP          = 13;
         public final static int FormatUDBTIMESTAMP          = 14;
         public final static int JANUARY          = 1;
         public final static int FEBRUARY     = 2;
         public final static int MARCH          = 3;
         public final static int APRIL          = 4;
         public final static int MAY               = 5;
         public final static int JUNE          = 6;
         public final static int JULY          = 7;
         public final static int AUGUST          = 8;
         public final static int SEPTEMBER     = 9;
         public final static int OCTOBER          = 10;
         public final static int NOVEMBER     = 11;
         public final static int DECEMBER     = 12;
         public final static int MONTHS_IN_YEAR = 12;
         public final static int SUNDAY          = 1;
         public final static int MONDAY          = 2;
         public final static int TUESDAY          = 3;
         public final static int WEDNESDAY     = 4;
         public final static int THURSDAY     = 5;
         public final static int FRIDAY          = 6;
         public final static int SATURDAY     = 7;
         public final static int DAYS_IN_WEEK = 7;
         private final static int DefaultHours   = 12;
         private final static int DefaultMinutes = 0;
         private final static int DefaultSeconds = 0;
         private final static int DefaultMillis     = 0;
         private final static int DaysInMonth[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
         private final static String MonthAbbrev[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
         private final static String MonthVerbose[] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" };
         private final static String DaysOfWeekAbbrev[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
         private final static String DaysOfWeek[] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };
         private final static String DayExtension[] = { "th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th" };
         private final static String EMPTY = "";
         private final static String COLON = ":";
         private final static String PERIOD = ".";
         private final static String HYPHEN = "-";
         private final static String SPACE = " ";
         private final static String ZERO  = "0";
         private static String s_dateSep = HYPHEN;
         private int m_dd, m_mm, m_yyyy, m_hh, m_min, m_ss, m_mil;
         private static long MillisInSecond     = 1000;
         private static long MillisInMinute     = MillisInSecond * 60;
         private static long MillisInHour     = MillisInMinute * 60;
         private static long MillisInDay          = MillisInHour * 24;
          * JDK_BST_FIX
          * Static initialisation block - check JDK vendor/version in order to determine whether
          * an adjustment to correctly report British summertime needs to be made. This is required
          * in order to fix a bug in some Sun & IBM JDKs. If an untested version of the Sun or IBM JDK
          * is used, we log an error message warning that this block of code should be examained and
          * changed as appropriate. This is ugly, but will prevent a new JDK being used and this bug
          * creeping back in.
          * Note the following JDKs have been tested under both NT & AIX
          *    JDK Version           NT          AIX
          *          1.1.7 (IBM)          x          x
          *          1.1.7A (IBM)               ?
          *          1.1.7B (IBM)     ?          ?
          *          1.1.8 (IBM)          x          x
          *          1.2.2 (IBM)          ok          ok
          *          1.1.7 (SUN)          x          x
          *          1.1.8 (SUN)          x          x
          *          1.2 (SUN)          x          x
         private final static String SunVendorString = "Sun Microsystems Inc.";
         private final static String IBMVendorString = "IBM"; // Can also be 'IBM Corporation'
         private final static String SunProblemJDKs[] = { "1.1.4", "1.1.5", "1.1.6", "1.1.7", "1.1.7A", "1.1.7B", "1.1.8", "1.2", "1.2.2" };
         private final static String     SunOKJDKs[] = { "1.0.2", "1.1.2", "1.1.3", "1.4.0", "1.4.2"};
         private final static String IBMProblemJDKs[] = { "1.1.4", "1.1.5", "1.1.6", "1.1.7", "1.1.7A", "1.1.8" };
         private final static String     IBMOKJDKs[] = { "1.0.2", "1.1.2", "1.1.3", "1.1.7B", "1.2.2", "1.3.0", "1.3.1" };
         private static boolean s_adjustForBST = false;
         static
              String vendor = System.getProperty("java.vendor");
              String jdk = System.getProperty("java.version");
              // Check applies to Sun only.
              if (vendor.equals(SunVendorString) || vendor.startsWith(IBMVendorString))
                   String problemJDKs[] = null;
                   String OKJDKs[] = null;
                   if (vendor.equals(SunVendorString))
                        problemJDKs = SunProblemJDKs;
                        OKJDKs = SunOKJDKs;
                   else
                        problemJDKs = IBMProblemJDKs;
                        OKJDKs = IBMOKJDKs;
                   // Determine whether we need to make adjustment
                   for (int i = 0; i < problemJDKs.length; i++)
                        if (problemJDKs.equals(jdk))
                             s_adjustForBST = true;
                             break;
                   // If we do not need to make the adjustment then check that the
                   // JDK reported is one of the versions that we know to be good.
                   // If it is not log an error message.
                   if (!s_adjustForBST)
                        boolean goodJDK = false;
                        for (int i = 0; i < OKJDKs.length; i++)
                             if (OKJDKs[i].equals(jdk))
                                  goodJDK = true;
                                  break;
    /* CR176 - we now anticipate that all JDKs post 1.3.x are "good" ones
                        if (!goodJDK)
                             // We do not use the SingletonLogger mechanism since we
                             // cannot be sure that these singleton objects have been instantiated
                             // at this point, and in any case it is not desirable to introduce
                             // this dependancy into SlacDate.
                             System.err.println("JDK VERSION ERROR : Unsupported JDK - '" + jdk + "' provided by '" + vendor + "'. SlacDate class requires examination.");
         * Construct the date with todays date.
         * <p>This should be the only place where a Date object is explicitly instantiated. All
         * other code should use SlacDate. If the s_adjustForBST flag is set and the date falls
         * between the last sunday of March and the last Sunday of October (inclusive) then we need
         * to make an adjustment of +1 hour so that British Summertime is correctly reported.
         private SlacDate()
              init(Calendar.getInstance());
         * Construct the date with the specified day, month and year.
         * @param year The year to set the date to
         * @param month The month to set the date to
         * @param date The date to set the date to
         * @exception InvalidDateException Invalid date parameters passed in.
         public SlacDate(int year, int month, int date) throws InvalidDateException
              init(year, month, date, DefaultHours, DefaultMinutes, DefaultSeconds, DefaultMillis);
         * Construct the date with the specified day, month, year, hour and minute.
         * @param year The year to set the date to
         * @param month The month to set the date to
         * @param date The date to set the date to
         * @param hr The hour to set the date to
         * @param min The minute to set the date to
         * @exception InvalidDateException Invalid date parameters passed in.
         public SlacDate(int year, int month, int date, int hr, int min) throws InvalidDateException
              init(year, month, date, hr, min, DefaultSeconds, DefaultMillis);
         * Construct the date with the specified day, month, year, hour, minute and second.
         * Will default to 0 milliseconds.
         * @param year The year to set the date to
         * @param month The month to set the date to
         * @param date The date to set the date to
         * @param hr The hour to set the date to
         * @param min The minute to set the date to
         * @param sec The second to set the date to
         * @exception InvalidDateException Invalid date parameters passed in.
         public SlacDate(int year, int month, int date, int hr, int min, int sec) throws InvalidDateException
              init(year, month, date, hr, min, sec, DefaultMillis);
         * Construct the date with the specified day, month, year, hour, minute, second and milliseconds.
         * @param year The year to set the date to
         * @param month The month to set the date to
         * @param date The date to set the date to
         * @param hr The hour to set the date to
         * @param min The minute to set the date to
         * @param sec The second to set the date to
         * @param millis The milliseconds to set the date to
         * @exception InvalidDateException Invalid date parameters passed in.
         public SlacDate(int year, int month, int date, int hr, int min, int sec, int millis) throws InvalidDateException
              init(year, month, date, hr, min, sec, millis);
         * Construct the date from a timestamp.
         public SlacDate(long timestamp) throws InvalidDateException
              Calendar cal = Calendar.getInstance();
              cal.setTime(new Date(timestamp));
              init(cal);
         * Construct the date from the specified string. Note that the date must
         * be in day/month/year format.
         * @param date The date string.
         * @exception InvalidDateException The date passed in is invalid.
         public SlacDate(String date) throws InvalidDateException
              init(date);
         * Construct the date from the specified string. The format passed in will
         * identify the format of the date.
         * @param date The date string.
         * @param format The format of the date.
         * @exception InvalidDateException The date passed in is invalid.
         public SlacDate(String date, int format) throws InvalidDateException
              if (format == FormatCCYYMMDD || format == FormatCCYYMMDDHHMM || format == FormatCCYYMMDDHHMMSS)
                   boolean valid = false;
                   date = date.trim();
                   if (date.length() >= 8)
                        try
                             int year = Integer.parseInt(date.substring(0,4));
                             int month = Integer.parseInt(date.substring(4,6));
                             int day = Integer.parseInt(date.substring(6,8));
                             int hour;
                             int min;
                             int sec;
                             if (date.length() > 8)
                                  hour = Integer.parseInt(date.substring(8,10));
                                  min = Integer.parseInt(date.substring(10,12));
                                  if (date.length() >= 14)
                                       sec = Integer.parseInt(date.substring(12,14));
                                  else
                                       sec = DefaultSeconds;
                             else
                                  hour = DefaultHours;
                                  min = DefaultMinutes;
                                  sec = DefaultSeconds;
                             init(year, month, day, hour, min, sec, DefaultMillis);
                             valid = true;
                        catch (Exception e)
                   if (!valid)
                        throw new InvalidDateException("Invalid date: " + date + " for the specified format");
              else if (format == FormatDB2TIMESTAMP || format == FormatUDBTIMESTAMP)
                   // 2002-02-04 10:49:30.999000 (UDB)
                   // 2002-02-04-10.49.30.999000 (DB2)
                   int year = Integer.parseInt(date.substring(0,4));
                   int month = Integer.parseInt(date.substring(5,7));
                   int day = Integer.parseInt(date.substring(8,10));
                   int hour = Integer.parseInt(date.substring(11,13));
                   int min = Integer.parseInt(date.substring(14,16));
                   int sec = Integer.parseInt(date.substring(17,19));
                   int millis = Integer.parseInt(date.substring(20,23));
                   init(year, month, day, hour, min, sec, millis);
              else
                   init(date);
         * Construct the date with the java.util.Date passed in.
         public SlacDate(Date date)
              init(date);
         * Init the date with the java.util.Date passed in.
         private void init(Date date)
              Calendar cal = Calendar.getInstance();
              cal.setTime(date);
              init(cal);
         * Return whether this date is after the date passed in.
         * @d2 The date to compare against.
         * @return Whether this date is after the date passed in.
         public boolean after(SlacDate d2)
              int xx = d2.getYear();
              if (m_yyyy > xx)
                   return true;
              else if (m_yyyy < xx)
                   return false;
              else
                   xx = d2.getMonth();
                   if (m_mm > xx)
                        return true;
                   else if (m_mm < xx)
                        return false;
                   else
                        xx = d2.getDate();
                        if (m_dd > xx)
                             return true;
                        else if (m_dd < xx)
                             return false;
                        else
                             xx = d2.getHour();
                             if (m_hh > xx)
                                  return true;
                             else if (m_hh < xx)
                                  return false;
                             else
                                  xx = d2.getMinute();
                                  if (m_min > xx)
                                       return true;
                                  else if (m_min < xx)
                                       return false;
                                  else
                                       xx = d2.getSecond();
                                       if (m_ss > xx)
                                            return true;
                                       else if (m_ss < xx)
                                            return false;
                                       else
                                            return (m_mil > d2.getMillisecond());
         private void appendHoursMinutes(StringBuffer str, String separator)
              if (m_hh < 10)
                   str.append(ZERO);
              str.append(Integer.toString(m_hh));
              if (!separator.equals(EMPTY))
                   str.append(separator);
              if (m_min < 10)
                   str.append(ZERO);
              str.append(Integer.toString(m_min));
         private void appendTime(StringBuffer str, String separator, boolean addMillis)
              appendHoursMinutes(str, separator);
              if (!separator.equals(EMPTY))
                   str.append(separator);
              if (m_ss < 10)
                   str.append(ZERO);
              str.append(Integer.toString(m_ss));
              if (addMillis)
                   if (!separator.equals(EMPTY))
                        str.append(separator);
                   if (m_mil < 100)
                        str.append(ZERO);
                        if (m_mil < 10)
                             str.append(ZERO);
                   str.append(m_mil);
         * Version of the asString() method which defaults to FormatDDMMCCYY.
         * <p>An example date in this format is:
         * <pre>
         * 25-02-1999
         * </pre>
         * @return The Date as a string in DDMMCCYY format.
         public String asString()
              return asString(FormatDDMMCCYY);
         * Convert the date to a String. This will format the Date as defined by the format
         * passed in. The default parameter is FormatDDMMCCYY.
         * The valid formats are:
         * <ul>
         * <li>FormatDDMMCCYY</li>
         * <li>FormatMMDDCCYY</li>
         * <li>FormatDATETIME</li>
         * <li>FormatDDMMTIME</li>
         * <li>FormatTIMESTAMP</li>
         * <li>FormatCCYYMMDD</li>
         * <li>FormatCCYYMMDDHHMM</li>
         * <li>FormatCCYYMMDDHHMMSS</li>
         * <li>FormatDDMMCCYYTIME</li>
         * <li>FormatDATEVERBOSE</li>
         * <li>FormatDATETIMEVERBOSE</li>
         * <li>FormatHHMMSS</li>
         * <li>FormatHHMMSSMIL</li>
         * <li>FormatDB2TIMESTAMP</li>
         * <li>FormatUDBTIMESTAMP</li>
         * </ul>
         * @param format The format to return the string in.
         * @return The date in string format (as specified by the format parameter).
         public String asString(int format)
              StringBuffer str = new StringBuffer(20);
              if (format == FormatDB2TIMESTAMP || format == FormatUDBTIMESTAMP)
                   str.append(Integer.toString(getYear()));
                   str.append(HYPHEN);
                   int month = getMonth();
                   if (month < 10)
                        str.append(ZERO);
                   str.append(Integer.toString(month));
                   str.append(HYPHEN);
                   int day = getDate();
                   if (day < 10)
                        str.append(ZERO);
                   str.append(Integer.toString(day));
                   String dateTimeSeparator = new String();
                   if (format == FormatDB2TIMESTAMP)
                        dateTimeSeparator = HYPHEN;
                   else if (format == FormatUDBTIMESTAMP)
                        dateTimeSeparator = SPACE;
                   str.append(dateTimeSeparator);
                   String timeSeparator = new String();
                   if (format == FormatDB2TIMESTAMP)
                        timeSeparator = PERIOD;
                   else if (format == FormatUDBTIMESTAMP)
                        timeSeparator = COLON;
                   appendTime(str, timeSeparator, true);
                   str.append("000");
              else if (format == FormatDATETIME || format == FormatMMMDDTIME || format == FormatTIMESTAMP)
                   str.append(getMonthNameAbbrev());
                   str.append(SPACE);
                   if (m_dd < 10)
                        str.append(ZERO);
                   str.append(Integer.toString(m_dd));
                   str.append(SPACE);
                   appendTime(str, COLON, false);
                   if (format == FormatDATETIME)
                        str.append(SPACE);
                        str.append(Integer.toString(m_yyyy));
                   else if (format == FormatTIMESTAMP)
                        str.append(COLON);
                        str.append(formattedMillis(m_mil));
              else if (format == FormatHHMMSS)
                   appendTime(str, COLON, false);
              else if (format == FormatHHMMSSMIL)
                   appendTime(str, COLON, true);
              else if (format == FormatCCYYMMDD || format == FormatCCYYMMDDHHMM || format == FormatCCYYMMDDHHMMSS)
                   str.append(Integer.toString(m_yyyy));
                   if (m_mm < 10)
                        str.append(ZERO);
                   str.append(Integer.toString(m_mm));
                   if (m_dd < 10)
                        str.append(ZERO);
                   str.append(Integer.toString(m_dd));
                   if (format == FormatCCYYMMDDHHMMSS)
                        appendTime(str, EMPTY, false);
                   else if (format == FormatCCYYMMDDHHMM)
                        appendHoursMinutes(str, EMPTY);
              else if (format == FormatDATEVERBOSE || format == FormatDATETIMEVERBOSE)
                   str.append(Integer.toString(m_dd));
                   if (m_dd > 10 && m_dd < 14)
                        str.append(DayExtension[0]);
                   else
                        str.append(DayExtension[m_dd%10]);
                   str.append(SPACE);
                   str.append(getMonthName());
                   str.append(SPACE);
                   str.append(Integer.toString(m_yyyy));
                   if (format == FormatDATETIMEVERBOSE)
                        str.append(",");
                        str.append(SPACE);
                        appendTime(str, COLON, false);
              else
                   // DDMMCCYY, MMDDCCYY, DDMMCCYYTIME
                   int first;
                   int second;
                   if (format != FormatMMDDCCYY)
                        first = getDate();
                        second = getMonth();
                   else
                        second = getDate();
                        first = getMonth();
                   if (first < 10)
                        str.append(ZERO);
                   str.append(Integer.toString(first));
                   str.append(s_dateSep);
                   if (second < 10)
                        str.append(ZERO);
                   str.append(Integer.toString(second));
                   str.append(s_dateSep);
                   str.append(Integer.toString(getYear()));
                   if (format == FormatDDMMCCYYTIME)
                        str.append(SPACE);
                        appendTime(str, COLON, false);
              return str.toString();
         * Return whether this date is before the date passed in
         * @d2 The date to compare against.
         * @return Whether this date is before the date passed in.
         public boolean before(SlacDate d2)
              return (!after(d2) && !equals(d2));
         * Clone the current date.
         * @return The cloned SlacDate object
         public Object clone()
              SlacDate d = new SlacDate();
              d.m_dd          = m_dd;
              d.m_mm          = m_mm;
              d.m_yyyy     = m_yyyy;
              d.m_hh          = m_hh;
              d.m_min          = m_min;
              d.m_ss          = m_ss;
              d.m_mil          = m_mil;
              return d;
         * Compare this date with the supplied date.
         * Hours, minutes, seconds and milliseconds are taken into consideration.
         * Returns:
         *      -1 this date is before the supplied date.
         *      0 this date is equal to the supplied date.
         *      1 this date is after the supplied date.
         public int compareTo(Object o2)
              SlacDate d2 = (SlacDate)o2;
              if (equals(d2))
                   return 0;
              if (after(d2))
                   return 1;
              return -1;
         * Compare this date with the supplied date.
         * Hours, minutes, seconds and milliseconds are NOT taken into consideration.
         * Returns:
         *      -1 this date is before the supplied date.
         *      0 this date is equal to the supplied date.
         *      1 this date is after the supplied date.
         public int compareDate(Object o2)
              SlacDate baseDate = (SlacDate)o2;
              SlacDate startBaseDate = new SlacDate(baseDate.getCalendar().getTime());
              startBaseDate.setHour(0);
              startBaseDate.setMinute(0);
              startBaseDate.setSecond(0);
              startBaseDate.setMillisecond(0);
              SlacDate endBaseDate = new SlacDate(baseDate.getCalendar().getTime());
              endBaseDate.setHour(23);
              endBaseDate.setMinute(59);
              endBaseDate.setSecond(59);
              endBaseDate.setMillisecond(999);
              int compare = 0;
              if (before(startBaseDate))
                   compare = -1;
              else if (after(endBaseDate))
                   compare = 1;
              return compare;
         * Compare this date with today's date.
         * Hours, minutes, seconds and milliseconds are NOT taken into consideration.
         * Returns:
         *      -1 this date is before today.
         *      0 this date is equal to today.
         *      1 this date is after today.
         public int compareToToday()
              return compareDate(today());
         * Calculate the difference (in days) between the two dates.
         * Note the difference may be negative.
         * @param from The <i>start</i> date
         * @param to The <i>to</i> date
         * @return The difference between the dates in days.
         public static int daysBetween(SlacDate from, SlacDate to)
              int dayFrom;
              int     monthFrom;
              int yrFrom;
              int dayTo;
              int     monthTo;
              int yrTo;
              int mult = 1;
              if (from.after(to))
                   mult=-1;
                   dayFrom          = to.getDate();
                   monthFrom     = to.getMonth();
                   yrFrom          = to.getYear();
                   dayTo          = from.getDate();
                   monthTo          = from.getMonth();
                   yrTo          = from.getYear();
              else
                   dayFrom          = from.getDate();
                   monthFrom     = from.getMonth();
                   yrFrom          = from.getYear();
                   dayTo          = to.getDate();
                   monthTo          = to.getMonth();
                   yrTo          = to.getYear();
              int cnt=0;
              try
                   if (yrFrom != yrTo)
                        // Different Years.
                        for (int i=yrFrom+1; i<yrTo; i++)
                             cnt += SlacDate.daysInYear(i);
                        for (int i=monthFrom+1; i<13; i++)
                             cnt+=daysInMonth(i, yrFrom);
                        for (int i=1; i<monthTo; i++)
                             cnt+=daysInMonth(i, yrTo);
                        cnt += (daysInMonth(monthFrom, yrFrom)-dayFrom);
                        cnt += dayTo;
                   else
                        if (monthFrom != monthTo)
                             // Same Year but different months.
                             for (int i=monthFrom+1; i<monthTo; i++)
                                  cnt+=daysInMonth(i, yrFrom);
                             cnt += (daysInMonth(monthFrom, yrFrom)-dayFrom);
                             cnt += dayTo;
                        else
                             // Same Year and month.
                             cnt += (dayTo-dayFrom);
              catch (InvalidDateException ide)
                   // This should never happen
              return cnt * mult;
         * Calculate the number of days from the specified date.
         * Note the difference may be negative.
         * @param date The date to calculate from
         * @return The diference between the two dates in days (may be negative).
         public int daysFrom(SlacDate date)
              return daysBetween(date, this);
         * Calculates the number of days in a given month in a given year
         * copes with century dates!
         * @param month The month to determine the day count
         * @param year The year the month is in (only relevant for February).
         * @exception InvalidDateException Invalid parameters passed in. Ie the month was >= 12
         *                    or the month was < 0.
         public static int daysInMonth(int month, int year) throws InvalidDateException
              if (month > 12 || month <= 0)
                   throw new InvalidDateException("Invalid month specified to SlacDate.daysInMonth(): " + month);
              // month-1, because DaysInMonth array is 0-based.
              return (month == FEBRUARY && isLeapYear(year)) ? 29 : DaysInMonth[month-1];
         * Calculates the number of days in a given year.
         * @param year The year the month is in (only relevant for February).
         public static int daysInYear(int year)
              return (isLeapYear(year)) ? 365 : 364;
         * Calculate the number of days to the specified date.
         * Note the difference may be negative.
         * @param date The date to calculate to
         * @return The diference between the two dates in days (may be negative).
         public int daysTo(SlacDate date)
              return daysBetween(this, date);
         * Decrement the date by the specified number of years, months and days.
         * @param years The number of years to increment by
         * @param months The number of months to increment by
         * @param days The number of days to increment by
         public void decrement(int years, int months, int days)
              decrementYears(years);
              decrementMonths(months);
              decrementDays(days);
         * Decrement the date by the specified number of days.
         * @param days The number of days to decrement by
         public void decrementDays(int days)
              incrementDays(days * -1);
         * Decrement the date by the specified number of hours.
         * @param hours The number of hours to decrement by
         public void decrementHours(int hours)
              incrementHours(hours * -1);
         * Decrement the date by the specified number of milliseconds.
         * @param seconds The number of seconds to decrement by
         public void decrementMilliseconds(int milliseconds)
              incrementMilliseconds(milliseconds * -1);
         * Decrement the date by the specified number of minutes.
         * @param minutes The number of minutes to decrement by
         public void decrementMinutes(int minutes)
              incrementMinutes(minutes * -1);
         * Decrement the date by the specified number of months.
         * @param years The number of months to decrement by
         public void decrementMonths(int months)
              incrementMonths(months * -1);
         * Decrement the date by the specified number of seconds.
         * @param seconds The number of seconds to decrement by
         public void decrementSeconds(int seconds)
              incrementSeconds(seconds * -1);
         * Decrement the date by the specified number of years.
         * @param years The number of years to decrement by
         public void decrementYears(int years)
              incrementYears(years * -1);
         * Calculate the difference between two dates to the nearest second as a String.
         * @param from The start date
         * @param to The end date
         public static String differenceBetween(SlacDate from, SlacDate to)
              SlacDate f, t;
              if (from.after(to))
                   t = from;
                   f = to;
              else
                   t = to;
                   f = from;
              int secs = 0;
              int mins = 0;
              int hours = 0;
              int days = 0;
              int months = 0;
              int years = 0;
              secs     = t.getSecond() - f.getSecond();
              mins     = t.getMinute() - f.getMinute();
              hours     = t.getHour() - f.getHour();
              days     = t.getDate() - f.getDate();
              months     = t.getMonth() - f.getMonth();
              years     = t.getYear() - f.getYear();
              if (secs < 0)
                   secs += 60;
                   mins--;
              if (mins < 0)
                   mins += 60;
                   hours--;
              if (hours < 0)
                   hours += 24;
                   days--;
              if (days < 0)
                   try
                        days += daysInMonth(f.getMonth(), f.getYear());
                   catch (InvalidDateException ide)
                        days += 30;
                   months--;
              if (months < 0)
                   months += 12;
                   years--;
              StringBuffer sb = new StringBuffer();
              sb.append(years).append(s_dateSep);
              sb.append(months).append(s_dateSep);
              sb.append(days).append(SPACE);
              sb.append(hours).append(COLON);
              sb.append(mins).append(COLON);
              sb.append(secs);
              return sb.toString();
         * Calculate the difference between the date passed in and this date.
         * Note that if the date passed in is in the future the difference will be
         * negative.
         * @param from The date from which to return the difference
         * @return The difference from the date passed in in String format
         public String differenceFrom(SlacDate from)
              return differenceBetween(from, this);
         * Calculate the difference between this date and the one passed in.
         * Note that if the date passed in is in the past the difference will be
         * negative.
         * @param to The date to which to return the difference
         * @return The difference to the date passed in in String format
         public String differenceTo(SlacDate to)
              return differenceBetween(this, to);
         * Return whether the two dates are the same. This will check right down to the second.
         * @param d2 The date to compare against
         * @return Whether the dates are the same.
         public boolean equals(SlacDate d2)
              return ((m_yyyy == d2.m_yyyy) &&
                        (m_mm == d2.m_mm) &&
                        (m_dd == d2.m_dd) &&
                        (m_hh == d2.m_hh) &&
                        (m_min == d2.m_min) &&
                        (m_ss == d2.m_ss) &&
                        (m_mil == d2.m_mil));
         public String format(DateFormat df)
              Calendar cal = getCalendar();
              return df.format(cal.getTime());
         private final String formattedMillis(int millis)
              String rString = null;
              if (millis < 10)
                   rString = "00" + millis;
              else if (millis < 100)
                   rString = ZERO + millis;
              else
                   rString = EMPTY + millis;
              return rString;
         public Calendar getCalendar()
              Calendar cal = Calendar.getInstance();
              cal.set(m_yyyy, m_mm-1, m_dd, m_hh, m_min, m_ss);
              cal.set(Calendar.MILLISECOND, m_mil);
              return cal;
         * Return the Date/Time in CCYYMMDD format.
         * <p>An example date in this format is:
         * <pre>
         * 19990225
         * </pre>
         * @return The Date as a string in CCYYMMDD format.
         public String getCCYYMMDD()
              return asString(FormatCCYYMMDD);
         * Return the Date/Time in CCYYMMDDHHMM format.
         * <p>An example date in this format is:
         * <pre>
         * 199902251423
         * </pre>
         * @return The Date as a string in CCYYMMDDHHMM format.
         public String getCCYYMMDDHHMM()
              return asString(FormatCCYYMMDDHHMM);
         * Return the Date/Time in CCYYMMDDHHMMSS format.
         * <p>An example date in this format is:
         * <pre>
         * 19990225142356
         * </pre>
         * @return The Date as a string in CCYYMMDDHHMMSS format.
         public String getCCYYMMDDHHMMSS()
              return asString(FormatCCYYMMDDHHMMSS);
         public int getDate()     { return m_dd; }
         * Return the date in DATETIME format.
         * <p>An example date in this format is:
         * <pre>
         * Feb 25 14:21:09 1999
         * </pre>
         * @return The Date as a string in DATETIME format.
         public String getDATETIME()
              return asString(FormatDATETIME);
         * Return the Date/Time in DATETIMEVERBOSE format.
         * <p>An example date in this format is:
         * <pre>
         * 25th February 1999, 14:21:09
         * </pre>
         * @return The Date as a string in DATETIMEVERBOSE format.
         public String getDATETIMEVERBOSE()
              return asString(FormatDATETIMEVERBOSE);
         * Return the Date/Time in DATEVERBOSE format.
         * <p>An example date in this format is:
         * <pre>
         * 25th February 1999
         * </pre>
         * @return The Date as a string in DATEVERBOSE format.
         public String getDATEVERBOSE()
              return asString(FormatDATEVERBOSE);
         * Return the day o

  • How to generate current time in the format yyyy-mm-ddThh:mm:ssZ in the xslt

    Hello,
    i am tring to generate current time in the format yyyy-mm-ddThh:mm:ssZ in my xlst file.
    the following info are necessary,
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:java="http://xml.apache.org/xslt/java" exclude-result-prefixes="java"
    version="1.0">
    <xsl:attribute name="generationDate"><xsl:value-of select="java:format(java:java.text.SimpleDateFormat.new('yyyy-mm-dd hh:mm:ss'), java:java.util.Date.new())"/></xsl:attribute>
    but java SimpleDateFormat doesnt support yyyy-mm-ddThh:mm:ssZ.
    thanks in advance.

    Hi wwuest,
    I use the following code to generate such a date format :
              try {
                   SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                   Date date = sdf.parse(strDate);
                   sdf.applyPattern("yyyy-MM-dd'T'hh:mm:ss");
                   strDate = sdf.format(date);
              } // catching the parse exceptionMaybe you could try this method and see if it pass through xsl with :
    new SimpleDateFormat("yyyy-MM-dd").applyPattern("yyyy-MM-dd'T'hh:mm:ss'Z'")Bye

  • Supported date formats for sorting

    Can someone point me to a document describing the supported
    date formats for sorting? I mean, how should I format a date column
    in an XML dataset in order to have this column correctly sorted
    using the Spry framework?
    Thank you and sorry if the question is trivial.

    Thanks, what I have done for the moment as a temporary
    solution is to use the two date formats and have them both inside
    the one cell in the table (the column for the sortable date
    yyyy-mm-dd). In my CSS I have created a style for the first date
    that has it's visibility as hidden. That way it's sorting the Date1
    but only Date2 is being shown to the users as the other cells have
    more than one line of text it doesn't look too off centre.
    <div spry:region="ds2">
    <table width="662">
    <tr>
    <th width="127" class="eventhead"
    spry:sort="Date1">Date</th>
    <th width="151" class="eventhead"
    spry:sort="Type">Type</th>
    <th width="146" class="eventhead"
    spry:sort="Title">Title</th>
    <th width="189" class="eventhead"
    spry:sort="Venue">Venue</th>
    </tr>
    <tr spry:repeat="ds2" spry:setrow="ds2">
    <td height="53" class="event">{Date2}<span
    class="eventhide">{Date1}</span></td>
    <td class="event">{Type}</td>
    <td class="event">{Title}</td>
    <td class="event">{Venue}</td>
    </tr>
    </table>
    </div>
    </div>
    It seems to be working for the moment...

  • List view error "Filter Value is not in a supported date format"

    I've column "Name = Order Status","Type = Calculated" & Data Type = "Date and Time". I've given this Condition in the formula:- =IF(NOT([PO Date]=0),"ORDERED","NOT ORDERED"). I'm trying to create view
    for this column but its getting error while create the view "Filter Value is not in a supported date format". 
    Same error I'm getting for column "Name = Status","Type = Calculated" & Data Type = "Number". I've given this Condition in the formula:- =IF([PO Date]="","",IF(NOT([Balance Qty]=0),"OPEN","CLOSED"))

    Can you check data type returned for your calculated column 'Balance Qty'?
    Try to set it as Number. It may help you.
    Thanks.

  • To Display Date format YYYY/MM/DD in Report

    Hi All,
    I wrote start routine code for field Document Date(ZDOC_DATE) to display date format YYYY/MM/DD ,but it displaying as 20090212.But my requirement is the date format should display 2009/02/12.
    Please find the below code which i have written,
    data : v_month(2) type n,
           v_year(4) type n,
           v_day(2) type n,
           v_Doc_Date(8) type c.
           v_month = ITAB-DOC_DATE+4(2).
           v_year = ITAB-DOC_DATE+0(4).
           v_day = ITAB-DOC_DATE+6(2).
           concatenate v_year v_month v_day into v_Doc_Date.
    result value of the routine
      RESULT = v_Doc_Date.
    Can any one please suggest  to display the date format as 2009/02/12.
    Thanks in advance
    karuna.

    Hi Rathy,
    As per your suggestion i have changed the document date lenght 10 & changed code ,the issue has been resolved now..date format showing 2009/03/22.
    data : v_month(2) type n,
    v_year(4) type n,
    v_day(2) type n,
    v_Doc_Date(10) type c.
    v_month = ITAB-DOC_DATE+4(2).
    v_year = ITAB-DOC_DATE+0(4).
    v_day = ITAB-DOC_DATE+6(2).
    concatenate v_year '/' v_month '/' v_day into v_Doc_Date.
    condense v_Doc_Date.
    result value of the routine
    RESULT = v_Doc_Date.
    Thanks for your quick response.
    Thanks to all.
    karuna

  • How to get the date format yyyy-mm-dd?

    Hi,
    I have an iphone (3.1.2) and would like to use the date format yyyy-mm-dd (international date format). Is the possible? If yes, how?
    Cheers

    I know of no other way to set the date format other than what I mentioned in my previous post. There are third party apps that will do what you want in the app. store, but they are not permitted to access the underlining software.

  • Convert date format yyyy-mm-dd to yyyymmdd

    Hi All,
    Could you please tell me how to do the mapping format to  Convert date format yyyy-mm-dd to yyyymmdd
    or
    Please provide any UDF for this conversion.
    Thank you .
    Regards,
    Bharat Kumar

    HI ,
    You can easily do that by using the standard datetransformation fuction . in the  property of that function put your coming source and desired target format . However once you specify the source format then the source field should always be in thaat format
    Regards,
    Saurabh

  • Change date format yyyy-MM-dd to MM/dd/yyyy

    Hi,
    How to change date format yyyy-MM-dd to MM/dd/yyyy
    Thanks

    a_bean wrote:
    Thanks guys,
    String updated = original.replaceFirst("(\\d{4})-(\\d{2})-(\\d{2})","$2/$3/$1");
    it workedIf, as you said in an earlier post (reply #4), you had the date as a java.util.Date object then this cannot have worked. Are you saying the date is stored as a String and not as a java.util.Date ?

  • How can i convert this data(00000000) into date format(yyyy-MM-dd)

    Hi,
    i am using this method to convert date format from string.
    public static string FormatDate(string inputDate, string inputFormat)
                System.DateTime date = DateTime.ParseExact(inputDate, inputFormat, null);
                string datepresent = DateTime.Now.Date.ToString("yyyy-MM-dd");
                return datepresent;
    its working properly,
    but when input data is like 00000000 i am getting error this is not valid.
    how can i convert this into date format any help..!

    Have you tried the above code:
    I can see it is working with both Date and DateTime destination nodes.
    Map:
    Functoid Parameters:
    Functoid Script:
    public static string FormatDate(string inputDate, string inputFormat)
    string datepresent;
    if (inputDate == "00000000")
    datepresent = "0000-00-00";
    else
    System.DateTime date = DateTime.ParseExact(inputDate, inputFormat, null);
    datepresent = date.ToString("yyyy-MM-dd");
    return datepresent;
    Input:
    <ns0:InputDateString xmlns:ns0="http://DateFormat.SourceSchema">
    <DateString>00000000</DateString>
    </ns0:InputDateString>
    Output:
    <ns0:OutputDate xmlns:ns0="http://DateFormat.DestinationSchema">
    <Date>0000-00-00</Date>
    </ns0:OutputDate>
    If this answers your question please mark as answer. If this post is helpful, please vote as helpful.

  • Converting date format yyyy-mm-dd to mm/dd/yyyy

    Hi,
    I need help converting the above date format. In the database the date is stored as a VARCHAR with the format yyyy-mm-dd
    but I would like it changed to DATE with the format mm/dd/yyyy. I tried the following and I keep getting invalid month
    select To_date(date_value, 'mm/dd/yyyy') as date_value from table
    When I try to convert it to char first before converting to date I get an invalid number error
    select to_date(to_char(date_value, 'mm/dd/yyyy'), 'mm/dd/yyyy') as date_value from table
    What do I do?
    Thanks for your help!!!

    Hi,
    The second argument of TO_DATE tells what format the first argument is already in.
    So you want:
    select  To_date (date_value, 'yyyy-mm-dd') as date_value
    from    table_x;Format is a quality of strings, not DATEs. Once you have converted your string to a DATE, is is stored in the same internal format as all the other DATEs. Use TO_CHAR to display it in any format you like.
    For example:
    SELECT     TO_CHAR ( TO_DATE (date_value, 'yyyy-mm-dd')
              , 'mm/dd/yyyy'
    FROM     table_x;Things are much easier if you store dates in DATE columns.

  • Changing Date format yyyy-mm-dd to dd-mm-yyyy in title view

    Hi I have some reports and in the title view I am using the dates..But it is in teh format yyyy-mm-dd.I am trying to change into mm-dd-yyyy
    in the title view I am using presenatation variables and so the format I am giving is @{PV1}['MM-DD-YYYY']
    but this is not giving any changes to my report.

    try this
    dayofmonth(date) month(date) year(date) .. use HTML to format it
    award points if it helps..
    ~Srix

  • Working with SAP Data Format yyyy.mm.dd in data services

    Hi,
    I had 2 questions about date formats coming from SAP to DS .
    1) I am trying to convert date fieild from SAP that is formated to yyyy.mm.dd to mm/dd/yyyy but I am not having any luck .. I am using the to_date function when I run this below I get null values in my template table . I think it has to do with me not stating my input date format but cannot seem to get the correct syntax's any ideas ?
    2) Does Data Services recognize dates which are formatted as  yyyy.mm.dd ?? When I put  I added a column to a template table and added the sys date command it returned the sys date as yyyy.mm.dd BUT when I try a fiscal_day function (which should brings back the number of days between the input (my SAP source date ) and the sys date which are formatted the same (yyyy.mm.dd) I get a format error  (input parameter 2009.03.10 is not valid) .  any ideas ?
    Thanks for your time,
    Brett

    Hello Brett
    to_date convert STRING to date based on input format.
    As i understand your source data not in string format.Is this correct?
    Use combination to_char->to_date for your transformation
    Regards
    Kanstantsin Chernichenka

  • Date format YYYY inserted as 0006 instead of 2006

    Hi,
    I have a strange problem in 9i database. When I execute the following procedure from TOAD's procedure editor, it inserts the year as 0006, buth when I execute it from sqlplus it inserts correctly as 2006.
    So the scenario wherein the proc inserts the year as 0006 happens only from our application(java-strut-based) and from TOAD's procedure editor.
    Please let me know if you have any clue on why it is happening only when executed from some clients. The NLS_DATE_FORMAT is already set as DD-MON-YYYY and all other database session level parameters,etc are correctly set.
    Procedure:
    CREATE OR REPLACE PROCEDURE test_year_format (
    IS
    v_start_date DATE;
    BEGIN
    DELETE FROM my_year_tab;
    --get the start date for the month
    SELECT TO_DATE (TO_CHAR (01) || '/' || '01' || '/' || TO_CHAR (2006),
    'mm/dd/yyyy'
    INTO v_start_date
    FROM DUAL;
    --This table has only one field that is of date datatype. The to_date inserts the year as 0006
    INSERT INTO my_year_tab
    VALUES (TO_DATE (v_start_date, 'dd-mon-yyyy'));
    COMMIT;
    END test_year_format;
    Thanks and regards,
    Ambili

    Hi,
    I agree with both prior posts about using TO_DATE(DATE type)...
    But, just for information, maybe TOAD is reading a "local environment variable date ormat" in this format 'DD/MM/YY' ...
    e.g:
    RPS@ORACLE10> select to_date('01/01/06','dd/mm/rrrr') from dual;
    TO_DATE('0
    01/01/2006
    RPS@ORACLE10> select to_date('01/01/06','dd/mm/yyyy') from dual;
    TO_DATE('0
    01/01/0006
    RPS@ORACLE10>Cheers

  • How to Change CrystalRepXI Enter Values Date Format yyyy-mm-dd 2 mm-dd-yyyy

    I am using Crystal Report XI for Report Development.
    I  am accepting date parameter field in report. When I run the report a dialog box pops up for accepting the Input Date.
    and the format that it accepts is 'yyyy-mm-dd' can I change this to 'mm-dd-yyyy'.
    Please suggest some solution, thank you in advance.
    -Sachin Doshi

    Ananth,
    I require this because its a client requirement, My clients wants to have input format in the same way as he wants it to see in the report.
    I have seen the Dates javascript files and I am surprised to see that the format is hardcoded. I think this is something non-standard. Crystal is allowing the user to format the date on the report then why is it resitricting while accepting.This is something very basic.
    Is there any quick resolution to this apart from converting the Date field to String.
    Please Help.

Maybe you are looking for