var myDate = new Date();myDate.getYear(); //获取当前年份(2位)myDate.getFullYear(); //获取完整的年份(4位,1970-????)myDate.getMonth(); //获取当前月份(0-11,0代表1月)myDate.getDate(); //获取当前日(1-31)myDate.getDay(); //获取当前星期X(0-6,0代表星期天)myDate.getTi…
# -*- coding: utf-8 -*- '''获取当前日期前后N天或N月的日期''' from time import strftime, localtime from datetime import timedelta, date import calendar year = strftime("%Y",localtime()) mon = strftime("%m",localtime()) day = strftime("%d",l…
Learn From:http://blog.csdn.net/sunhuwh/article/details/39161323 public class CalendarTest { public static void main(String[] args) { // 获取当前年份.月份.日期 Calendar cale = null; cale = Calendar.getInstance(); int year = cale.get(Calendar.YEAR); int month =…
var myDate = new Date();myDate.getYear(); //获取当前年份(2位)myDate.getFullYear(); //获取完整的年份(4位,1970-????)myDate.getMonth(); //获取当前月份(0-11,0代表1月)myDate.getDate(); //获取当前日(1-31)myDate.getDay(); //获取当前星期X(0-6,0代表星期天)myDate.getTi…
var myDate = new Date();myDate.getYear(); //获取当前年份(2位)myDate.getFullYear(); //获取完整的年份(4位,1970-????)myDate.getMonth(); //获取当前月份(0-11,0代表1月)myDate.getDate(); //获取当前日(1-31)myDate.getDay(); //获取当前星期X(0-6,0代表星期天)myDate.getTi…
原文地址: http://www.cnblogs.com/Gnepner/archive/2011/09/07/2169822.html 获取当前日期时间: function GetCurrentDateTime() { var d = new Date(); var year = d.getFullYear(); var month = d.getMonth() + 1; var date = d.getDate(); var week = d.getDay(); var hours = d.…
今天项目中用到了一点 随便记录一下 function timestampToTime(timestamp) { );//时间戳为10位需*1000,时间戳为13位的话不需乘1000 var Y = date.getFullYear() + '-'; < ? ) : date.getMonth()+) + '月'; var D = date.getDate(); var h = date.getHours() + ':'; var m = date.getMinutes() + ':'; var…