Project

General

Profile

« Previous | Next » 

Revision 5429

Added by berkley over 14 years ago

hudson tests are now running. needed date conversions. still more work to do with systemmetadata date format.

View differences:

src/edu/ucsb/nceas/metacat/restservice/ResourceHandler.java
405 405
            Event event = null;
406 406
            if(fromDateS != null)
407 407
            {
408
                //fromDate = CrudService.getInstance().parseDate(fromDateS);
409
                fromDate = dateFormat.parse(fromDateS);
408
                //fromDate = dateFormat.parse(fromDateS);
409
                fromDate = parseDateAndConvertToGMT(fromDateS);
410 410
            }
411 411
            if(toDateS != null)
412 412
            {
413
                //toDate = CrudService.getInstance().parseDate(toDateS);
414
                toDate = dateFormat.parse(toDateS);
413
                //toDate = dateFormat.parse(toDateS);
414
                toDate = parseDateAndConvertToGMT(toDateS);
415 415
            }
416 416
            if(eventS != null)
417 417
            {
......
782 782
     */
783 783
    private Date parseDateAndConvertToGMT(String date) throws ParseException
784 784
    {
785
        System.out.println("Parsing date " + date);
785
        try
786
        {   //the format we want
787
            return dateFormat.parse(date);
788
        }
789
        catch(java.text.ParseException pe)
790
        {   //try another legacy format
791
            DateFormat dateFormat2 = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss'Z'");
792
            dateFormat2.setTimeZone(TimeZone.getTimeZone("GMT-0"));
793
            return dateFormat2.parse(date);
794
        }    
795
        
796
        /*System.out.println("Parsing date " + date);
786 797
        Date d = dateFormat.parse(date);
787 798
        
788 799
        if(date.endsWith("Z"))
......
802 813
        }
803 814
        
804 815
        System.out.println("date parsed, but not converted. returned as " + d);
805
        return d;
816
        return d;*/
806 817
    }
807 818

  
808 819
    /**

Also available in: Unified diff