How to Validate Date on Submit with Condition?

I want to validate the date field only when user enter a
data, otherwise it will pass as no vlaue when user click on submit.
var theDate2 = new
Spry.Widget.ValidationTextField("theDate2", "date",
{useCharacterMasking:true, format:"mm/dd/yyyy", hint:"mm/dd/yyyy",
validateOn:["submit"]});
Thanks

Hi helloha33,
You're probably going to have to do something like what
Dragos mentions in this posting:
http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=72&catid=602&threadid =1221205&highlight_key=y&keyword1=conditional
Specifically, you'll add an onchange handler on your
<input> textfield which calls some function that will execute
the constructor call you mention above.
--== Kin ==--

Similar Messages

  • How to fetch data from Mysql with SSL.

    I am using jdk1.5 and mysql 5.0.
    How to fetch data from Mysql with SSL
    I am using url = jdbc:mysql://localhost/database?useSSL=true&requireSSL=true.
    It shows error. how to fetch

    I have created certificate in mysql and checked in mysql.
    mysql>\s
    SSL: Cipher in use is DHE-RSA-AES256-SHA
    but through ssl how to fetch data in java.

  • How to validate Date

    Hi,
    We have a date field in the form. I am validating date format as YYYY-MM-DD, validation works fine. But If user enters invalid date, how to validate date? For examples:
    2006-02-31 It is an invalid date. How can i validate it.
    If anybody have sample code, it will help me a lot.
    thanks
    Neopal.

    Hi Neopal,
    You can use something like the following to test the date is valid, use the validation event on the <Field> which you want to validate to call a Rule something like this (not complete)..
      <Rule name='isDateValid'>
            <RuleArgument name='date'/>
            <block>
           <script>
              var dateToTest = env.get('date');
              var formatter = new java.text.SimpleDateFormat('YYYY-MM-DD');
              Date validDate = formatter.parse(dateToTest);

  • I need a COMPLETE tutorial on how to make a smart playlist with 'conditions'

    Ok, I have read discussions in the Support Communities, looked on iTunes Help and I think my brain is going to explode. I need a simple (for dummies) tutorial on how to create a smart playlist with 'conditions' and Live Updating. For example: instead of going through my Library music list and unchecking all my Christmas music and all my Comedy stuff so it won't play year round and at innapropriate times and having to skip them manually when playing on my ipod touch or my iphone4 in my car or through headphones or home sharing and using my AppleTV.
    Also, if my comedy is individually all unchecked (in my iTunes Library), and I have a regular playlist in my ipod and one in my iphone (titled Comedy), when I go to the playlist list in my ipod or phone (when not connected to my Mac), and select shuffle: will that playlist play all the way through even though they are all unchecked?
    AND, if I have 'sync only checked songs and video' box UNCHECKED in my summary page for a device what exactly does that do? Or more precisely, WHY would I want or not want that box to be checked?
    I really hope someone can help me as I am a complete idiot when it comes to understanding long explanations.

    katinak67 wrote:
    AND, if I have 'sync only checked songs and video' box UNCHECKED in my summary page for a device what exactly does that do? Or more precisely, WHY would I want or not want that box to be checked?
    If the box is unchecked, it won't do anything. It will sync everything.
    If it is checked, songs that are unchecked will nto get sync'd to the iPod.
    katinak67 wrote:
    For example: instead of going through my Library music list and unchecking all my Christmas music and all my Comedy stuff so it won't play year round and at innapropriate times and having to skip them manually when playing on my ipod touch or my iphone4 in my car or through headphones or home sharing and using my AppleTV.
    Select all the Christmas stuff, right click - get info.
    Set the sure the Genre is Christmas.
    Go to the Info tab and set Skip when Shuffling to Yes.
    Do the same for Comedy.
    Create a new smart playlist (named My Music or something similar).
    Match all rules;
    Genre is not Christmas.
    Genre is not Comedy.
    Play this playlist on the iPod/iTunes to listen to everything except Christmas & Comedy.
    Or if you have Shuffle turned on, just listen to anything and Christmas & Comedy will get skipped.
    Also, if my comedy is individually all unchecked (in my iTunes Library), and I have a regular playlist in my ipod and one in my iphone (titled Comedy), when I go to the playlist list in my ipod or phone (when not connected to my Mac), and select shuffle: will that playlist play all the way through even though they are all unchecked?
    It depends.
    In iTunes, unchecked items will get skipped.
    If unchecekd items get sync'd to the iPod (you do NOT have Sync only cheked items ticked), they will play unless you have them set to Skip when shuffling.

  • How to take data dump(export) with given language set on oracle 9i database(production server) ?

    Hi,
    I am taken data dump on oracle 9i machine and ported (imported ) oracle 10g (production machine) ,But it will showing error : language set error,
    Could you tell me how to take data dump with language set.
    Regards,
    Suva

    Hi PaulM,
         Please follows the details, 
    Development server  ,It is 9i machine (I am export in this machine) and Imported on Production Server ( It is Oracle 10 g).
        When import on production server error is coming, Tis error log adding below.
    Production Databse (Language details)
    NLS_LANGUAGE AMERICAN
    NLS_TERRITORY AMERICA
    NLS_CURRENCY $
    NLS_ISO_CURRENCY AMERICA
    NLS_NUMERIC_CHARACTERS .,
    NLS_CHARACTERSET UTF8
    NLS_CALENDAR GREGORIAN
    NLS_DATE_FORMAT DD-MON-RR
    NLS_DATE_LANGUAGE AMERICAN
    NLS_SORT BINARY
    NLS_TIME_FORMAT HH.MI.SSXFF AM
    NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM
    NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR
    NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR
    NLS_DUAL_CURRENCY $
    NLS_COMP BINARY
    NLS_LENGTH_SEMANTICS BYTE
    NLS_NCHAR_CONV_EXCP FALSE
    NLS_NCHAR_CHARACTERSET UTF8
    NLS_RDBMS_VERSION 10.2.0.1.0
    Development Database  Language details Details.
    NLS_LANGUAGE AMERICAN
    NLS_TERRITORY AMERICA
    NLS_CURRENCY $
    NLS_ISO_CURRENCY AMERICA
    NLS_NUMERIC_CHARACTERS .,
    NLS_CHARACTERSET UTF8
    NLS_CALENDAR GREGORIAN
    NLS_DATE_FORMAT DD-MON-RR
    NLS_DATE_LANGUAGE AMERICAN
    NLS_SORT BINARY
    NLS_TIME_FORMAT HH.MI.SSXFF AM
    NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM
    NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR
    NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR
    NLS_DUAL_CURRENCY $
    NLS_COMP BINARY
    NLS_LENGTH_SEMANTICS BYTE
    NLS_NCHAR_CONV_EXCP FALSE
    NLS_NCHAR_CHARACTERSET UTF8
    NLS_RDBMS_VERSION 10.2.0.1.0
    Log file
    Connected to: Oracle Database 10g Release 10.2.0.1.0 - Production
    Export file created by EXPORT:V09.02.00 via conventional path
    import done in WE8MSWIN1252 character set and UTF8 NCHAR character set
    import server uses UTF8 character set (possible charset conversion)
    export server uses AL16UTF16 NCHAR character set (possible ncharset conversion)
    . importing JW_OR's objects into JW_OR
    . importing JW_OS's objects into JW_OS
    . importing JW_ADMIN's objects into JW_ADMIN
    . importing JW_OR's objects into JW_OR
    . . importing table                      "ACCRXNS"     234671 rows imported
    . . importing table                  "AUTHORLINKS"     790450 rows imported
    . . importing table                      "AUTHORS"      79500 rows imported
    . . importing table                       "CATSOL"      25505 rows imported
    . . importing table               "CATSOLSYNONYMS"      80045 rows imported
    . . importing table                "CHAPTERTITLES"        133 rows imported
    . . importing table                "COMPOUNDLINKS"     601785 rows imported
    . . importing table                   "CONDITIONS"     207445 rows imported
    . . importing table                     "JOURNALS"       2327 rows imported
    . . importing table                     "LANGUAGE"          0 rows imported
    . . importing table                     "MAINDATA"     234659 rows imported
    . . importing table                      "MOLDATA"     721174 rows imported
    . . importing table                   "PLAN_TABLE"          1 rows imported
    . . importing table                   "REFERENCES"     276783 rows imported
    . . importing table                        "ROLES"          2 rows imported
    . . importing table                  "RXNKEYLINKS"    1724404 rows imported
    . . importing table                  "RXNKEYWORDS"        848 rows imported
    . . importing table                  "TABLETITLES"       2400 rows imported
    . . importing table                   "TEMP_TABLE"     165728 rows imported
    . . importing table          "TEMP_WILEY_MAINDATA"     155728 rows imported
    . . importing table           "TEMP_WILEY_PDF_MAP"      16672 rows imported
    . . importing table      "TEMP_WILEY_YEAR_VOL_MAP"         42 rows imported
    . . importing table                  "WEX_ACCRXNS"       3465 rows imported
    . . importing table              "WEX_AUTHORLINKS"      14183 rows imported
    . . importing table                  "WEX_AUTHORS"      79500 rows imported
    . . importing table            "WEX_CHAPTERTITLES"        133 rows imported
    . . importing table            "WEX_COMPOUNDLINKS"      10925 rows imported
    . . importing table               "WEX_CONDITIONS"       5297 rows imported
    . . importing table                 "WEX_JOURNALS"       2327 rows imported
    . . importing table                 "WEX_LANGUAGE"          0 rows imported
    . . importing table                 "WEX_MAINDATA"       3465 rows imported
    . . importing table                  "WEX_MOLDATA"      10358 rows imported
    . . importing table               "WEX_REFERENCES"       3795 rows imported
    . . importing table              "WEX_RXNKEYLINKS"      34540 rows imported
    . . importing table              "WEX_RXNKEYWORDS"        848 rows imported
    . . importing table              "WEX_TABLETITLES"       2400 rows imported
    . . importing table           "WEX_WILEY_HTML_MAP"      17316 rows imported
    . . importing table           "WEX_WILEY_MAINDATA"       3465 rows imported
    . . importing table            "WEX_WILEY_PDF_MAP"      23925 rows imported
    . . importing table       "WEX_WILEY_YEAR_VOL_MAP"         58 rows imported
    . . importing table               "WILEY_HTML_MAP"      17316 rows imported
    . . importing table               "WILEY_MAINDATA"     234659 rows imported
    . . importing table                "WILEY_PDF_MAP"      23925 rows imported
    . . importing table           "WILEY_YEAR_VOL_MAP"         58 rows imported
    . importing JW_OS's objects into JW_OS
    . . importing table                      "ACCRXNS"       7116 rows imported
    . . importing table                   "ATMOSPHERE"         47 rows imported
    . . importing table                  "AUTHORLINKS"      33276 rows imported
    . . importing table                      "AUTHORS"       6555 rows imported
    . . importing table                       "CATSOL"       1463 rows imported
    . . importing table               "CATSOLSYNONYMS"       9370 rows imported
    . . importing table                    "CHEMICALS"      78197 rows imported
    . . importing table                "COMPOUNDLINKS"      20799 rows imported
    . . importing table                       "EXPDET"          1 rows imported
    . . importing table                    "FOOTNOTES"      77825 rows imported
    . . importing table                     "JOURNALS"          2 rows imported
    . . importing table                     "LANGUAGE"          2 rows imported
    . . importing table                     "MAINDATA"       7116 rows imported
    . . importing table                     "PATHSTEP"       7199 rows imported
    . . importing table               "PROCEDURENOTES"      77293 rows imported
    . . importing table                        "ROLES"          2 rows imported
    . . importing table                  "RXNKEYLINKS"      23096 rows imported
    . . importing table                  "RXNKEYWORDS"       1272 rows imported
    . . importing table                  "WEX_ACCRXNS"        135 rows imported
    . . importing table               "WEX_ATMOSPHERE"         47 rows imported
    . . importing table              "WEX_AUTHORLINKS"        613 rows imported
    . . importing table                  "WEX_AUTHORS"       6555 rows imported
    . . importing table                "WEX_CHEMICALS"          0 rows imported
    . . importing table            "WEX_COMPOUNDLINKS"        497 rows imported
    . . importing table                   "WEX_EXPDET"          1 rows imported
    . . importing table                "WEX_FOOTNOTES"       2184 rows imported
    . . importing table                 "WEX_JOURNALS"          2 rows imported
    . . importing table                 "WEX_LANGUAGE"          2 rows imported
    . . importing table                 "WEX_MAINDATA"        135 rows imported
    . . importing table                 "WEX_PATHSTEP"        135 rows imported
    . . importing table           "WEX_PROCEDURENOTES"       2253 rows imported
    . . importing table              "WEX_RXNKEYLINKS"        695 rows imported
    . . importing table              "WEX_RXNKEYWORDS"       1272 rows imported
    . importing JW_ADMIN's objects into JW_ADMIN
    . . importing table                     "APP_USER"         76 rows imported
    . . importing table                       "AUTHOR"      61874 rows imported
    . . importing table                     "CITATION"
    IMP-00019: row rejected due to ORACLE error 12899
    IMP-00003: ORACLE error 12899 encountered
    ORA-12899: value too large for column "JW_ADMIN"."CITATION"."PAGE" (actual: 9, maximum: 8)
    Column 1 10794
    Column 2 77
    Column 3 1
    Column 4 24
    Column 5
    Column 6 Science of Synthesis
    Column 7 Negishi, E.-i.; Takahashi, T. Science of Synthesis...
    Column 8 681–848
    Column 9 2
    Column 10
    Column 11 2002
    IMP-00019: row rejected due to ORACLE error 12899
    IMP-00003: ORACLE error 12899 encountered
    ORA-12899: value too large for column "JW_ADMIN"."CITATION"."PAGE" (actual: 10, maximum: 8)
    Column 1 10879
    Column 2 77
    Column 3 1
    Column 4 110
    Column 5
    Column 6 Comprehensive Organic Synthesis
    Column 7 Hiemstra, H.; Speckamp, W. N.; Trost, B. M.; Flemi...
    Column 8 1047–108
    Column 9 2
    Column 10
    Column 11
    IMP-00019: row rejected due to ORACLE error 12899
    IMP-00003: ORACLE error 12899 encountered
    ORA-12899: value too large for column "JW_ADMIN"."CITATION"."PAGE" (actual: 10, maximum: 8)
    Column 1 10880
    Column 2 77
    Column 3 1
    Column 4 111
    Column 5
    Column 6 Houben-Weyl Methods of Organic Chemistry
    Column 7 De Koning, H.; Speckamp, W. N.; Helmchen, G.; Hoff...
    Column 8 1953–200
    Column 9 E21b
    Column 10
    Column 11 1995
    IMP-00019: row rejected due to ORACLE error 12899
    IMP-00003: ORACLE error 12899 encountered
    ORA-12899: value too large for column "JW_ADMIN"."CITATION"."PAGE" (actual: 10, maximum: 8)
    Column 1 10904
    Column 2 77
    Column 3 1
    Column 4 135
    Column 5
    Column 6 Houben-Weyl Methods of Organic Chemistry
    Column 7 Ryu, I.; Murai, S.; de Meijere, A., Ed. Houben-Wey...
    Column 8 1985–204
    Column 9 E17c
    Column 10
    Column 11 1997
    IMP-00019: row rejected due to ORACLE error 12899
    IMP-00003: ORACLE error 12899 encountered
    ORA-12899: value too large for column "JW_ADMIN"."CITATION"."PAGE" (actual: 9, maximum: 8)
    Column 1 10905
    Column 2 77
    Column 3 1
    Column 4 136
    Column 5
    Column 6 The Chemistry of the Cyclopropyl Group
    Column 7 Tsuji, T.; Nishida, S.; Patai, S.; Rappoport, Z., ...
    Column 8 307–373
    Column 9
    Column 10
    Column 11 1987
    IMP-00019: row rejected due to ORACLE error 12899
    IMP-00003: ORACLE error 12899 encountered
    ORA-12899: value too large for column "JW_ADMIN"."CITATION"."PAGE" (actual: 10, maximum: 8)
    Column 1 10906
    Column 2 77
    Column 3 1
    Column 4 137
    Column 5
    Column 6 The Chemistry of the Cyclopropyl Group
    Column 7 Vilsmaier, E.; Patai, S.; Rappoport, Z., Eds. The ...
    Column 8 1341–145
    Column 9
    Column 10
    Column 11 1987
    IMP-00019: row rejected due to ORACLE error 12899
    IMP-00003: ORACLE error 12899 encountered
    ORA-12899: value too large for column "JW_ADMIN"."CITATION"."PAGE" (actual: 9, maximum: 8)
    Column 1 10952
    Column 2 77
    Column 3 1
    Column 4 183
    Column 5
    Column 6 Cyclopropane-Derived Reactive Intermediates
    Column 7 Boche, G.; Walborsky, H. M. Cyclopropane-Derived R...
    Column 8 117–173
    Column 9
    Column 10
    Column 11 1990
    IMP-00019: row rejected due to ORACLE error 12899
    IMP-00003: ORACLE error 12899 encountered
    ORA-12899: value too large for column "JW_ADMIN"."CITATION"."PAGE" (actual: 10, maximum: 8)
    Column 1 10958
    Column 2 77
    Column 3 1
    Column 4 189
    Column 5
    Column 6 Houben-Weyl Methods of Organic Chemistry
    Column 7 Klunder, A. J. H.; Zwanenburg, B. Houben-Weyl Meth...
    Column 8 2419–243
    Column 9 E17c
    Column 10
    Column 11 1997
    IMP-00019: row rejected due to ORACLE error 12899
    IMP-00003: ORACLE error 12899 encountered
    ORA-12899: value too large for column "JW_ADMIN"."CITATION"."PAGE" (actual: 9, maximum: 8)
    Column 1 10995
    Column 2 77
    Column 3 1
    Column 4 226
    Column 5
    Column 6 Science of Synthesis
    Column 7 Cha, J. K. Science of Synthesis 2005, 325–338.
    Column 8 325–338
    Column 9
    Column 10
    Column 11 2005
    IMP-00019: row rejected due to ORACLE error 12899
    IMP-00003: ORACLE error 12899 encountered
    ORA-12899: value too large for column "JW_ADMIN"."CITATION"."PAGE" (actual: 10, maximum: 8)
    Column 1 17123
    Column 2 82
    Column 3 1
    Column 4 13
    Column 5
    Column 6 Comprehensive Organometallic Chemistry II
    Column 7 Dushin, R. G.; Edward, W. A.; Stone, F. G. A.; Wil...
    Column 8 1071–109
    Column 9 12
    Column 10
    Column 11 1995
    IMP-00019: row rejected due to ORACLE error 12899
    IMP-00003: ORACLE error 12899 encountered
    ORA-12899: value too large for column "JW_ADMIN"."CITATION"."PAGE" (actual: 9, maximum: 8)
    Column 1 17124
    Column 2 82
    Column 3 1
    Column 4 14
    Column 5
    Column 6 Modern Carbonyl Olefination
    Column 7 Ephritikhine, M.; Villiers, C.; Takeda, T. Ed. Mod...
    Column 8 223–285
    Column 9
    Column 10
    Column 11 2004
    IMP-00019: row rejected due to ORACLE error 12899
    IMP-00003: ORACLE error 12899 encountered
    ORA-12899: value too large for column "JW_ADMIN"."CITATION"."PAGE" (actual: 9, maximum: 8)
    Column 1 17126
    Column 2 82
    Column 3 1
    Column 4 16
    Column 5
    Column 6 Transition Metals for Organic Synthesis (2nd Editi...
    Column 7 Furstner, A.; Beller, M.; Bolm, C. Eds. Transition...
    Column 8 449–468
    Column 9
    Column 10
    Column 11 2004      17712 rows imported
    . . importing table                     "FOOTNOTE"         38 rows imported
    . . importing table              "GT_STATS_REPORT"          0 rows imported
    . . importing table         "GT_VALIDATION_REPORT"          0 rows imported
    . . importing table                     "OR_USERS"          1 rows imported
    . . importing table                     "OS_USERS"          1 rows imported
    . . importing table                "PROCEDURENOTE"         70 rows imported
    . . importing table                  "QC_TRACKING"     539881 rows imported
    . . importing table                         "ROLE"          5 rows imported
    . . importing table                       "SCHEMA"          3 rows imported
    . . importing table              "TASK_ALLOCATION"     159370 rows imported
    . . importing table                     "USER_LOG"     174488 rows imported
    . . importing table                      "VERSION"          3 rows imported
    About to enable constraints...
    IMP-00017: following statement failed with ORACLE error 2298:
    "ALTER TABLE "AUTHOR" ENABLE CONSTRAINT "FK_AUTHOR_CITATIONID""
    IMP-00003: ORACLE error 2298 encountered
    ORA-02298: cannot validate (JW_ADMIN.FK_AUTHOR_CITATIONID) - parent keys not found
    Import terminated successfully with warnings.
    Regards,
    Subash

  • 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 validate date picker value

    Hi,
    When a date is entered manually in the date picker .ie 01/03/08 the year 08 is saved as 0008 in the database rather than 2008. How to validate the value in date picker to save the year as 2008 instead of 0008.
    Ven

    The date picker does not always "store" the value for you - you create it with a particular format such as DD-MON-YY and then like any character to date field you need to be careful to use a format mask and to_date. Alternatively, change the format to DD-MON-YYYY.
    Are you using this in a query or defined as a page item? Do you have the app on the APEX site?
    Phil

  • How to show Date and Time with TimeZone

    Dear All,
    I have to show Date and Time with TimeZone abbreviation,
    for example:
    1) 31 March 2011 2:30 in india standard time - it should show in screen 31 March 2011 2:30 IST.
    2) 31 March 2011 2:30 in Australia/New Zealand - Eastern time zone it should show in screen 31 March 2011 2:30 AEST.
    how can i show *Australia/New Zealand - Eastern time zone to AEST*,
    I tried with format DD MMM YYYY HH:MM zzz, and i looked time zone API too.
    Appreciate your help
    Thanks
    Daya

    Dayananda wrote:
    ok, than i have to use zzzz format, as z won't help in my case, so i have to use zzzz which display descriptive value like, Indian Standard Time i.e. ISTPer the javadocs there is a very specific reason why that is a problem especially if you intend to support many timezones in one application.
    "+For compatibility with JDK 1.1.x, some other three-letter time zone IDs (such as "PST", "CTT", "AST") are also supported. However, their use is deprecated because the same abbreviation is often used for multiple time zones (for example, "CST" could be U.S. "Central Standard Time" and "China Standard Time"), and the Java platform can then only recognize one of them+."
    Thus you have one single case where there can be many and moreover it can change (twice a year I believe.)
    There is a standard source for this information although when I tried it it appears to not work.
    If the app only needs to display one zone then provide a configuration value that allows a user to overload the display value.
    If the app needs to display many values then you MUST inform business users of the problem because there are duplicates and they, not you, need to decide specifically what happens in those cases.

  • How to fetch data where reference with two values

    Hello Gurus,
    How to fetch data from database table with two values for reference. like
             SELECT  < FIELDS>
                              FROM <DB>
                              INTO TABLE TAB2
                              FOR ALL ENTRIES IN
                              TAB1
                              WHERE
                               FIELD1 = TAB1-FIELD1 AND
                               FIELD1 =  TAB1-FIELD2.

    Hi,
    If you want to get data for both fields then Instead of AND use OR
            SELECT  < FIELDS> 
                              FROM <DB>
                              INTO TABLE TAB2
                              FOR ALL ENTRIES IN
                              TAB1
                              WHERE
                               FIELD1 = TAB1-FIELD1 OR
                               FIELD1 =  TAB1-FIELD2.
    Or if you want that only common data for both fields should be fetched then create new internal table. Append data of both fields into that table. Sort new table and do delete adjust duplicate. Now use new internal table in your select query.
    Let me know if this helps.
    Regards,
    Jigar Thakkar.

  • HELP! How to validate DATE?

    Hello...
    how to validate a DATE variable?
    I have used SimpleDateFormat (dd/MM/yyyy).
    For some input it worked fine, but for:
    12/67/200394 (OK!) <- this is false, right? but not trapped!
    1234546 (TRAPPED!)
    12/324/1234 (OK!) <- this is false, right? but not trapped!
    I need to have a 100% working Date validator.
    Plz Help.
    Thank you.

    Hey -
    I used to following code on your dates to get the results you were looking for...
    import java.text.SimpleDateFormat;
    import java.text.ParsePosition;
    import java.util.Date;
    public class DateFormatTest {
         public static void main(String[] args) {
              SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
              df.setLenient(false);
              ParsePosition pos = new ParsePosition(0);
              String strDate = " 12/67/200394";
              Date date = df.parse(strDate, pos);
                    // Check all possible things that signal a parsing error
              if ((date == null) || (pos.getErrorIndex() != -1)) {
                   System.out.println("Error: " + pos.getIndex());
                   if (date == null) {
                        System.out.println("Date is null");
                   if (pos.getErrorIndex() != -1) {
                        System.out.println("Error index: " + pos.getErrorIndex());
    }I hope there's something helpful in there
    Lee

  • How to save data in columns with headers?

    I'm trying to save 10 different types of data into individual columns with headers, but I can either get one giant column of data with the given header at the start of each data set (imbeded in the column) or I can get the headers in different columns, but the data all in one row. This seems like a simple problem, but for the life of me I can't figure it out--HELP!
    I've attached my code...don't laugh, I think I've created a monster trying to figure this out. What I'm trying to get is one column with the header "Power (watts)" and then the power data in that column, one column with the header "angular acceleration (rad/s^2)" and then the angular acceleration data in that column, and so on...
    Thanks!
    Attachments:
    RILE-25.vi ‏335 KB

    Hi
    Take a look at this VI / Block diagram pic
    Here, I am demonstrating how to write data to a file column wise along with relevant column headers
    Hope this helps
    Regards
    Dev
    Attachments:
    header_column data.JPG ‏49 KB
    header_column data.vi ‏20 KB

  • How to validate an XML file with XSD Schema on JDK 1.4

    Hi
    I'm looking for samples how to validate xml files with xsd schema using jsdk 1.4
    Thank you.

    This is how.
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.transform.dom.DOMResult;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.validation.Schema;
    import javax.xml.validation.SchemaFactory;
    import javax.xml.validation.Validator;
    DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance();
    dbfac.setNamespaceAware(true);
    SchemaFactory factory1 = SchemaFactory
                        .newInstance("http://www.w3.org/2001/XMLSchema");
    Schema schema = factory1.newSchema(new File("person.xsd"));
    dbfac.setSchema(schema);
    DocumentBuilder dbparser1 = dbfac.newDocumentBuilder();
    Document doc1 = dbparser1.parse(new File("person.xml"));
    Validator validator1 = schema.newValidator();
    DOMSource dm1 = new DOMSource(doc1);
    DOMResult domresult1 = new DOMResult();
    validator1.validate(dm1, domresult1);

  • Validating Data... How to validate before you submit via sendData()

    I can validate the data fine, but how would I check to see if it is valid before I send the data to the server?
    I want to validateData() then sendData()
             private function sendData(e:Event=null):void {
                  author = new VOAuthor();
                  author.contactName = name_lb.text;
                  author.email = company_lb.text;
                  author.phone = phone_lb.text;
                  author.company = company_lb.text;
                  author.comments = comments_lb.text;
                  contactDB.submitQuote(author);
             private function validateData():void {
                    //(string must be two characters or longer)
                    nameValidator = new StringValidator();
                    nameValidator.source = name_lb;
                    nameValidator.property = "text";
                    nameValidator.minLength = 4;
                    // Phone validator
                    phoneValidator = new PhoneNumberValidator();
                    phoneValidator.source = phone_lb;
                    phoneValidator.property = "text";
                    // Email validator
                    emailValidator = new EmailValidator();   
                    emailValidator.source = email_lb;
                    emailValidator.property = "text";

    use validate property which returns validationresultevent:
    nameValidator = new StringValidator();
    nameValidator.source = name_lb;
    nameValidator.property = "text";
    nameValidator.minLength = 4;
    var r:ValidationResultEvent = nameValidator.validate();
    if(r.type == ValidationResultEvent.INVALID)
    Alert.show(r.message);
    // invalid.

  • How to validate date and timestamp format? Please help!

    Hi experts,
       I have a input field "receipt_date" with is of char20 type. It contains date and timestamp value like 20090429T054509.000Z
       In my ABAP code I want to validate if "receipt_date" value is in the format YYYYMMDDTHHMMSS.MMMZ. If not then display error message. How can do this validation? Is there any existing function module that does this kind of validation? Please help!
    Thanks & Regards
    Gopal

    Hi Gopal,
    Can you check whether the FM CACS_TIMESTAMP_GET_DATE is available in XApps? If yes, use this to identify a valid timestamp.
    Sample code:
        CALL FUNCTION 'CACS_TIMESTAMP_GET_DATE'
          EXPORTING
            i_timestamp = lv_stamp
          IMPORTING
            e_date      = lv_datum
            e_time      = lv_time.
    Hope this helps! Do let me know if you need anything else!!
    Cheers,
    Shailesh.
    Always provide feedback for helpful answers

  • How to validate data is in specific list while loading from SQL*Loader

    I have a sample data file like below
    1,name1,05/02/2012 10:00:00,blue
    2,name2,06/02/2012 10:00:00,red
    3,name3,07/02/2012 10:00:00,yellow
    4,name4,08/02/2012 10:00:00,white
    I would like to validate 4Th column to be a valid color (ie) All color should be in a specific list, if it is not in the lis then the record should do to bad/discard file
    How can do that while loading Data From SQL*Loader?

    user8860934 wrote:
    I have a sample data file like below
    1,name1,05/02/2012 10:00:00,blue
    2,name2,06/02/2012 10:00:00,red
    3,name3,07/02/2012 10:00:00,yellow
    4,name4,08/02/2012 10:00:00,white
    I would like to validate 4Th column to be a valid color (ie) All color should be in a specific list, if it is not in the lis then the record should do to bad/discard file
    How can do that while loading Data From SQL*Loader?Probably a lot easier with an EXTERNAL TABLE (they're much more flexible).
    Is SQL Loader a mandatory requirement for some reason?

Maybe you are looking for

  • TS3276 Help in setting Apple Mail to receive and send mail via Yahoo mail service

    I would appreciate help in setting up Apple Mail to receive and send e-mails via Yahoo.   Thank you

  • How to create MIN/MAX limitations in SELECT statement ??

    Hey, I have a table which rank90 (city population ranked from 1>*) and state_abrv which has the corresponding state for each city rank. Is there a way to select only the maximum AND minimum ranks for each state ?? I realise there is a max and min fun

  • How to Get iTunes to Recognize New Nano?

    Hi, Let me re-phrase an earlier question that got no response (sob): I have been using a mini for years, but the battery is nearly dead, so my husband gave me his brand new video Nano. When I connect it to my computer, iTunes doesn't recognize it. An

  • Flash and Html combined elements

    I have a question, basically what I have is a flash site, and one of those sections is a news section, when someone clicks on that section i want it to open up html webpage within flash and then be able to scroll up and down the page because i know i

  • Extremely slow PP Export with Dynamic Links

    I have very slow exports from Premiere Pro that are entirely made with Dynamic Links to AE (green screen footage). It's taking about 4+ hours to export a 12 minute video! I'm on an iMac late 2012 3.2 GHz Intel Core i5 24 GB 1600 MHz DDR3 NVIDIA GeFor