package com.studychen.seenews.util; import android.content.Context; /** * Created by tomchen on 2/26/16. */ public class GetTimeAgo { ; * SECOND_MILLIS; * MINUTE_MILLIS; * HOUR_MILLIS; /** * 按照毫秒来存储 * * @param time * @return */ public static String g
1. 取今天时间 $date -d "now" +%Y-%m-%d 2. 取昨天时间 $date -d "yesterday" +%Y-%m-%d $date -d "1 days ago" +%Y-%m-%d ## -d, --date=STRING display time described by STRING, not `now'STRING可以为‘now’ . ‘yesterday’. ‘n days ago’‘n da
GMT:格林尼标准时间 北京时间=GMT时间+8小时 DataTime nowDate = DataTime.Now; nowDate.toString("r"); 效果为: Wed, 22 Jul 2009 16:24:33 GMT 參数解释: d ShortDatePattern D LongDatePattern f 完整日期和时间(长日期和短时间) F FullDateTimePattern(长日期和长时间) g 常规(短日期和短时间) G 常规(短日期和长时间) m
Java时间格式转换大全 import java.text.*; import java.util.Calendar; public class VeDate { /** * 获取现在时间 * * @return 返回时间类型 yyyy-MM-dd HH:mm:ss */ public static Date getNowDate() { Date currentTime = new Date(); SimpleDateFormat formatter = new SimpleDateForma
//获取当前时间,格式YYYY-MM-DD function getNowFormatDate() { var date = new Date(); var seperator1 = "-"; var year = date.getFullYear(); var month = date.getMonth() + 1; var strDate = date.getDate(); if (month >= 1 && month <= 9) { month =