当前位置: 首页>>代码示例>>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;未经允许,请勿转载。