當前位置: 首頁>>代碼示例>>Java>>正文


Java DateTime.parseRfc3339方法代碼示例

本文整理匯總了Java中com.google.api.client.util.DateTime.parseRfc3339方法的典型用法代碼示例。如果您正苦於以下問題:Java DateTime.parseRfc3339方法的具體用法?Java DateTime.parseRfc3339怎麽用?Java DateTime.parseRfc3339使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.api.client.util.DateTime的用法示例。


在下文中一共展示了DateTime.parseRfc3339方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getLocalNewTaskMap

import com.google.api.client.util.DateTime; //導入方法依賴的package包/類
public HashMap<Integer, Task> getLocalNewTaskMap(){
 ArrayList<Integer> allNewId = recorder.getAllNewId();
 HashMap<Integer, Task> result = new HashMap<Integer, Task>();
 if(!allNewId.isEmpty()){
  for(int id : allNewId){
	  Task t = new Task();
	  boolean completed  = recorder.getTaskCompletedByID(id);
	  boolean deleted = recorder.getTaskDeleteByID(id);
	  DateTime updateTime = DateTime.parseRfc3339(recorder.getUpdateTimeByID(id));
	  String identifier = recorder.getTaskIdentifierByID(id);
	  String title = recorder.getTaskTitleByID(id);
	  t.setDeleted(deleted);
	  t.setTitle(title);
	  if(completed){
		  t.setStatus("completed");// Fuck!!! Why MUST use it instead of setCompleted!!!!
	  }
	  t.setUpdated(updateTime);
	  t.setId(identifier);
	  result.put(id, t);
  }
 }
 return result;
}
 
開發者ID:dacer,項目名稱:SimplePomodoro-android,代碼行數:24,代碼來源:TaskLocalUtils.java

示例2: getTasksFromDB

import com.google.api.client.util.DateTime; //導入方法依賴的package包/類
public List<Task> getTasksFromDB(){
 ArrayList<Integer> allId = recorder.getAllId();
 List<Task> listTask = new ArrayList<Task>();
 for (Integer id : allId){
  Task t = new Task();
  boolean completed  = recorder.getTaskCompletedByID(id);
  boolean deleted = recorder.getTaskDeleteByID(id);
  DateTime updateTime = DateTime.parseRfc3339(recorder.getUpdateTimeByID(id));
  String identifier = recorder.getTaskIdentifierByID(id);
  String title = recorder.getTaskTitleByID(id);
  t.setDeleted(deleted);
  t.setTitle(title);
  if(completed){
	  t.setStatus("completed");// Fuck!!! Why MUST use it instead of setCompleted!!!!
  }
  t.setUpdated(updateTime);
  t.setId(identifier);
  listTask.add(t);
 }
 return listTask;
}
 
開發者ID:dacer,項目名稱:SimplePomodoro-android,代碼行數:22,代碼來源:TaskLocalUtils.java

示例3: setStartAndEndDate

import com.google.api.client.util.DateTime; //導入方法依賴的package包/類
private static void setStartAndEndDate(Event event, Activity activity, int semester) {
    String startingDate = getStartingDateOfActivity(activity, semester).toString(),
            timeZone = (semester == 1 ? ":00.000+03:00" : ":00.000+02:00");

    DateTime start = DateTime.parseRfc3339(startingDate + "T" + activity.getStartingHour() + timeZone);
    DateTime end = DateTime.parseRfc3339(startingDate + "T" + activity.getEndingHour() + timeZone);

    event.setStart(new EventDateTime().setDateTime(start).setTimeZone("Europe/Bucharest"));
    event.setEnd(new EventDateTime().setDateTime(end).setTimeZone("Europe/Bucharest"));
}
 
開發者ID:greenadex,項目名稱:timetable-builder,代碼行數:11,代碼來源:TimetableBuilder.java

示例4: deserialize

import com.google.api.client.util.DateTime; //導入方法依賴的package包/類
@Override
public DateTime deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) {
    DateTime result = null;
    try {
        String date = jsonElement.getAsString();
        result = DateTime.parseRfc3339(date);
    } catch (NumberFormatException e)  {
        System.err.println("Couldn't parse date: " + jsonElement.getAsString());
    }
    return result;
}
 
開發者ID:Asana,項目名稱:java-asana,代碼行數:12,代碼來源:Json.java

示例5: getOffset

import com.google.api.client.util.DateTime; //導入方法依賴的package包/類
public static DateTime getOffset(Bundle args) {
    return args == null || !args.containsKey(ARG_OFFSET) ? null :
            DateTime.parseRfc3339(args.getString(ARG_OFFSET));
}
 
開發者ID:wuman,項目名稱:android-oauth-client,代碼行數:5,代碼來源:PlurksLoadable.java

示例6: testBigOffset

import com.google.api.client.util.DateTime; //導入方法依賴的package包/類
/**
     * Test case for http://code.google.com/p/diy-zoning/issues/detail?id=14
     */
    @Test
    public void testBigOffset() {
        
        NDC.push("testBigOffset");
        
        try {
        
        Calendar tempCalendar = new GregorianCalendar();
        DateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
        NumberFormat tzFormatter = new DecimalFormat("+#00;-#00");
        
        tempCalendar.set(Calendar.HOUR_OF_DAY, 0);
        tempCalendar.set(Calendar.MINUTE, 0);
        tempCalendar.set(Calendar.SECOND, 0);
        tempCalendar.set(Calendar.MILLISECOND, 0);
        
//        tempCalendar.setTimeZone(TimeZone.getTimeZone("GMT+1200"));
        
        Date start = tempCalendar.getTime();

        tempCalendar.set(Calendar.HOUR_OF_DAY, 23);
        tempCalendar.set(Calendar.MINUTE, 59);
        tempCalendar.set(Calendar.SECOND, 59);
        tempCalendar.set(Calendar.MILLISECOND, 0);
        
        Date end = tempCalendar.getTime();
        
        int tzShift = tempCalendar.getTimeZone().getRawOffset() / (60000 * 60);
        String tzTail = tzFormatter.format(tzShift) + ":00";
        
        logger.debug("Start date with no TZ offset: " + dateFormatter.format(start));
        
        String startString = dateFormatter.format(start) + tzTail;
        String endString = dateFormatter.format(end) + tzTail;
        
        logger.debug("String to parse: " + startString);
        
        DateTime.parseRfc3339(startString);
        DateTime.parseRfc3339(endString);
        
        logger.debug("Parsed OK");
        
        } catch (Throwable t) {
            
            logger.error("Oops", t);
            
            fail(t.getMessage());
            
        } finally {
            NDC.pop();
        }
    }
 
開發者ID:home-climate-control,項目名稱:dz,代碼行數:56,代碼來源:GCalScheduleUpdaterTest.java

示例7: parseEvents

import com.google.api.client.util.DateTime; //導入方法依賴的package包/類
private void parseEvents(Map<Thermostat, SortedMap<Period, ZoneStatus>> ts2schedule, Set<Thermostat> tSet, Calendar calendarClient, String id) throws IOException {

        NDC.push("parseEvents");
        Marker m = new Marker("parseEvents");

        try {

            com.google.api.services.calendar.Calendar.Events.List events = calendarClient.events().list(id);
            
            java.util.Calendar tempCalendar = new GregorianCalendar();
            
            tempCalendar.set(java.util.Calendar.HOUR_OF_DAY, 0);
            tempCalendar.set(java.util.Calendar.MINUTE, 0);
            tempCalendar.set(java.util.Calendar.SECOND, 0);
            tempCalendar.set(java.util.Calendar.MILLISECOND, 0);
            
            Date start = tempCalendar.getTime();

            tempCalendar.set(java.util.Calendar.HOUR_OF_DAY, 23);
            tempCalendar.set(java.util.Calendar.MINUTE, 59);
            tempCalendar.set(java.util.Calendar.SECOND, 59);
            tempCalendar.set(java.util.Calendar.MILLISECOND, 0);
            
            Date end = tempCalendar.getTime();
            
            // Now, let's produce the time zone offset and shove it down the throat of
            // Google's invention that isn't capable of parsing normal TZ representation.
            // This will not work with fractional offsets, but you know what?
            // Go fix it yourself if you live in one of those time zones.
            
            int tzShift = tempCalendar.getTimeZone().getRawOffset() / (60000 * 60);
            String tzTail = tzFormatter.format(tzShift) + ":00";
            
            DateFormat dateFormatter = new SimpleDateFormat(dateFormat);
            DateTime dtStart = DateTime.parseRfc3339(dateFormatter.format(start) + tzTail);
            DateTime dtEnd = DateTime.parseRfc3339(dateFormatter.format(end) + tzTail);
            
            events.setTimeMin(dtStart);
            events.setTimeMax(dtEnd);
            events.setSingleEvents(true);
            
            logger.info("query: " + events);
            
            Events feed = events.execute();
            
            // cal.query() has been known to get stuck, let's update the timestamp
            touch();            

            parse(ts2schedule, tSet, feed.getItems());

        } finally {

            m.close();
            NDC.pop();
        }

    }
 
開發者ID:home-climate-control,項目名稱:dz,代碼行數:58,代碼來源:GCalScheduleUpdater.java


注:本文中的com.google.api.client.util.DateTime.parseRfc3339方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。