科学网

 找回密码
  注册

tag 标签: Date

相关帖子

版块 作者 回复/查看 最后发表

没有相关内容

相关日志

Matlab: date&time 日期与时间信息提取与转换
haibaraxx 2017-1-20 21:31
描述: 现有文件acs_05_230715_1811.dat,第1行包含日期与时间信息,内部结构如下: 问题: 将日期与时间提取出来,保存成变量,并进行类型转换。 脚本: ------------------------------------------------------------------------------------------------------------ 脚本1 fid=fopen('acs_05_230715_1811.dat','r'); line=fgetl(fid); % get the first line line(find(line=='-'))='/'; % 将-替换成/ DateStr=line(17:35); DateNum=datenum(DateStr,'mm/dd/yyyy HH:MM:SS'); %same with: DateNum=datenum(DateStr,0); DateVec=datevec(DateStr,'mm/dd/yyyy HH:MM:SS'); % same with: DateVec=datevec(DateStr,0); fclose(fid); ------------------------------------------------------- 脚本2 fid=fopen('acs_05_230715_1811.dat','r') line=fgetl(fid); % get the first line DateStr=line(17:35); DateNum=datenum(DateStr,'mm-dd-yyyy HH:MM:SS'); DateVec=datevec(DateStr,'mm-dd-yyyy HH:MM:SS'); fclose(fid); ------------------------------------------------------------------------------------------------------------ 脚本文件: DateTime.txt % 运行到第5行:变量line为 char型 ,内容为acs_05_230715_1811.dat的第1行. % 运行到第6行 :变量line为 char型 ,内容为将acs_05_230715_1811.dat第1行的-替换成/. % 运行到第8行 :变量DateStr为char型. % 运行到第9行 :变量DateNum转化为时间的数值格式,double型. % 运行到第10行 :变量DateVec转化为时间的向量格式,double型.
个人分类: Matlab|13738 次阅读|0 个评论
time
ymjyxw 2016-4-20 10:26
In order to display the start execution time of programme, you can add following matlab code in beginning or end of your .m file. % cur_date = date; cur_time = fix(clock); str = sprintf('%s %.2d:%.2d:%.2d\n', cur_date, cur_time(4), cur_time(5),cur_time(6)); disp( ) %
个人分类: Matlab|1238 次阅读|0 个评论
SQL 高级教程---SQL Date 函数(30)
helloating1990 2016-1-12 19:58
SQL 日期 当我们处理日期时,最难的任务恐怕是确保所插入的日期的格式,与数据库中日期列的格式相匹配。 只要数据包含的只是日期部分,运行查询就不会出问题。但是,如果涉及时间,情况就有点复杂了。 在讨论日期查询的复杂性之前,我们先来看看最重要的内建日期处理函数。 MySQL Date 函数 下面的表格列出了 MySQL 中最重要的内建日期函数: 函数 描述 NOW() 返回当前的日期和时间 CURDATE() 返回当前的日期 CURTIME() 返回当前的时间 DATE() 提取日期或日期/时间表达式的日期部分 EXTRACT() 返回日期/时间按的单独部分 DATE_ADD() 给日期添加指定的时间间隔 DATE_SUB() 从日期减去指定的时间间隔 DATEDIFF() 返回两个日期之间的天数 DATE_FORMAT() 用不同的格式显示日期/时间 SQL Server Date 函数 下面的表格列出了 SQL Server 中最重要的内建日期函数: 函数 描述 GETDATE() 返回当前日期和时间 DATEPART() 返回日期/时间的单独部分 DATEADD() 在日期中添加或减去指定的时间间隔 DATEDIFF() 返回两个日期之间的时间 CONVERT() 用不同的格式显示日期/时间 SQL Date 数据类型 MySQL 使用下列数据类型在数据库中存储日期或日期/时间值: DATE - 格式 YYYY-MM-DD DATETIME - 格式: YYYY-MM-DD HH:MM:SS TIMESTAMP - 格式: YYYY-MM-DD HH:MM:SS YEAR - 格式 YYYY 或 YY SQL Server 使用下列数据类型在数据库中存储日期或日期/时间值: DATE - 格式 YYYY-MM-DD DATETIME - 格式: YYYY-MM-DD HH:MM:SS SMALLDATETIME - 格式: YYYY-MM-DD HH:MM:SS TIMESTAMP - 格式: 唯一的数字 SQL 日期处理 如果不涉及时间部分,那么我们可以轻松地比较两个日期! 假设我们有下面这个 Orders 表: OrderId ProductName OrderDate 1 computer 2008-12-26 2 printer 2008-12-26 3 electrograph 2008-11-12 4 telephone 2008-10-19 现在,我们希望从上表中选取 OrderDate 为 2008-12-26 的记录。 我们使用如下 SELECT 语句: SELECT * FROM Orders WHERE OrderDate='2008-12-26' 结果集: OrderId ProductName OrderDate 1 computer 2008-12-26 3 electrograph 2008-12-26 现在假设 Orders 类似这样(请注意 OrderDate 列中的时间部分): OrderId ProductName OrderDate 1 computer 2008-12-26 16:23:55 2 printer 2008-12-26 10:45:26 3 electrograph 2008-11-12 14:12:08 4 telephone 2008-10-19 12:56:10 如果我们使用上面的 SELECT 语句: SELECT * FROM Orders WHERE OrderDate='2008-12-26' 那么我们得不到结果。这是由于该查询不含有时间部分的日期。 提示: 如果您希望使查询简单且更易维护,那么请不要在日期中使用时间部分!
个人分类: 数据库|655 次阅读|0 个评论
网站天地:Ruby语言日期时间格式化函数strftime
cnruby 2015-2-16 16:59
网站: http://www.foragoodstrftime.com/ 代码:Time.now.strftime(%a, %e %b %Y %H:%M:%S %z) 参考:http://apidock.com/ruby/Time/strftime
个人分类: 软件与编程|3284 次阅读|0 个评论
[转载]Java处理日期格式2
itso310 2014-4-18 00:15
引自: http://blog.csdn.net/ccs02287/article/details/5984474 import java.util.Date; import java.text.DateFormat; /** * 格式化时间类 DateFormat.FULL = 0 DateFormat.DEFAULT = 2 DateFormat.LONG = 1 * DateFormat.MEDIUM = 2 DateFormat.SHORT = 3 */ public class Test { public static void main(String[] args) { Date d = new Date(); String s; /** Date类的格式: Sat Apr 16 13:17:29 CST 2006 */ System.out.println(d); System.out.println(******************************************); /** getDateInstance() */ /** 输出格式: 2006-4-16 */ s = DateFormat.getDateInstance().format(d); System.out.println(s); /** 输出格式: 2006-4-16 */ s = DateFormat.getDateInstance(DateFormat.DEFAULT).format(d); System.out.println(s); /** 输出格式: 2006年4月16日 星期六 */ s = DateFormat.getDateInstance(DateFormat.FULL).format(d); System.out.println(s); /** 输出格式: 2006-4-16 */ s = DateFormat.getDateInstance(DateFormat.MEDIUM).format(d); System.out.println(s); /** 输出格式: 06-4-16 */ s = DateFormat.getDateInstance(DateFormat.SHORT).format(d); System.out.println(s); /** 输出格式: 2006-01-01 00:00:00 */ java.text.DateFormat format1 = new java.text.SimpleDateFormat( yyyy-MM-dd hh:mm:ss); s = format1.format(new Date()); System.out.println(s); /** 输出格式: 2006-01-01 01:00:00 */ System.out.println((new java.text.SimpleDateFormat( yyyy-MM-dd hh:mm:ss)).format(new Date())); /** 输出格式: 2006-01-01 13:00:00 */ System.out.println((new java.text.SimpleDateFormat( yyyy-MM-dd HH:mm:ss)).format(new Date())); /** 输出格式: 20060101000000 ***/ java.text.DateFormat format2 = new java.text.SimpleDateFormat( yyyyMMddhhmmss); s = format2.format(new Date()); System.out.println(s); } }
个人分类: java|1493 次阅读|0 个评论
[转载]java处理日期格式1
itso310 2014-4-18 00:13
本文引自:http://qsfwy.iteye.com/blog/602891 Java中日期格式转换 /** * 字符串转换为java.util.Datebr * 支持格式为 yyyy.MM.dd G 'at' hh:mm:ss z 如 '2002-1-1 AD at 22:10:59 PSD'br * yy/MM/dd HH:mm:ss 如 '2002/1/1 17:55:00'br * yy/MM/dd HH:mm:ss pm 如 '2002/1/1 17:55:00 pm'br * yy-MM-dd HH:mm:ss 如 '2002-1-1 17:55:00' br * yy-MM-dd HH:mm:ss am 如 '2002-1-1 17:55:00 am' br * @param time String 字符串br * @return Date 日期br */ public static Date stringToDate(String time){ SimpleDateFormat formatter; int tempPos=time.indexOf("AD") ; time=time.trim() ; formatter = new SimpleDateFormat ("yyyy.MM.dd G 'at' hh:mm:ss z"); if(tempPos-1){ time=time.substring(0,tempPos)+ "公元"+time.substring(tempPos+"AD".length());//china formatter = new SimpleDateFormat ("yyyy.MM.dd G 'at' hh:mm:ss z"); } tempPos=time.indexOf("-"); if(tempPos-1(time.indexOf(" ")0)){ formatter = new SimpleDateFormat ("yyyyMMddHHmmssZ"); } else if((time.indexOf("/")-1) (time.indexOf(" ")-1)){ formatter = new SimpleDateFormat ("yyyy/MM/dd HH:mm:ss"); } else if((time.indexOf("-")-1) (time.indexOf(" ")-1)){ formatter = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss"); } else if((time.indexOf("/")-1) (time.indexOf("am")-1) ||(time.indexOf("pm")-1)){ formatter = new SimpleDateFormat ("yyyy-MM-dd KK:mm:ss a"); } else if((time.indexOf("-")-1) (time.indexOf("am")-1) ||(time.indexOf("pm")-1)){ formatter = new SimpleDateFormat ("yyyy-MM-dd KK:mm:ss a"); } ParsePosition pos = new ParsePosition(0); java.util.Date ctime = formatter.parse(time, pos); return ctime; } /** * 将java.util.Date 格式转换为字符串格式'yyyy-MM-dd HH:mm:ss'(24小时制)br * 如Sat May 11 17:24:21 CST 2002 to '2002-05-11 17:24:21'br * @param time Date 日期br * @return String 字符串br */ public static String dateToString(Date time){ SimpleDateFormat formatter; formatter = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss"); String ctime = formatter.format(time); return ctime; } /** * 将java.util.Date 格式转换为字符串格式'yyyy-MM-dd HH:mm:ss a'(12小时制)br * 如Sat May 11 17:23:22 CST 2002 to '2002-05-11 05:23:22 下午'br * @param time Date 日期br * @param x int 任意整数如:1br * @return String 字符串br */ public static String dateToString(Date time,int x){ SimpleDateFormat formatter; formatter = new SimpleDateFormat ("yyyy-MM-dd KK:mm:ss a"); String ctime = formatter.format(time); return ctime; } /** *取系统当前时间:返回只值为如下形式 *2002-10-30 20:24:39 * @return String */ public static String Now(){ return dateToString(new Date()); } /** *取系统当前时间:返回只值为如下形式 *2002-10-30 08:28:56 下午 *@param hour 为任意整数 *@return String */ public static String Now(int hour){ return dateToString(new Date(),hour); } /** *取系统当前时间:返回值为如下形式 *2002-10-30 *@return String */ public static String getYYYY_MM_DD(){ return dateToString(new Date()).substring(0,10); } /** *取系统给定时间:返回值为如下形式 *2002-10-30 *@return String */ public static String getYYYY_MM_DD(String date){ return date.substring(0,10); } public static String getHour(){ SimpleDateFormat formatter; formatter = new SimpleDateFormat ("H"); String ctime = formatter.format(new Date()); return ctime; } public static String getDay(){ SimpleDateFormat formatter; formatter = new SimpleDateFormat ("d"); String ctime = formatter.format(new Date()); return ctime; } public static String getMonth(){ SimpleDateFormat formatter; formatter = new SimpleDateFormat ("M"); String ctime = formatter.format(new Date()); return ctime; } public static String getYear(){ SimpleDateFormat formatter; formatter = new SimpleDateFormat ("yyyy"); String ctime = formatter.format(new Date()); return ctime; } public static String getWeek(){ SimpleDateFormat formatter; formatter = new SimpleDateFormat ("E"); String ctime = formatter.format(new Date()); return ctime; } 在jsp页面中的日期格式和sqlserver中的日期格式不一样,怎样统一? 在页面上显示输出时,用下面的函数处理一下 public class DateUtil(){ public static String fmtShortEnu(Date myDate) { SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd"); String strDate = formatter.format(myDate); return strDate; } } new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); new java.text.SimpleDateFormat("yyyy-MM-dd") 建议还是把sqlserver的字段类型改成varchar的吧,用字符串处理可以完全按照自己的意愿处理,没有特殊的需求,不要使用date型 字串日期格式转换 用的API是SimpleDateFormat,它是属於java.text.SimpleDateFormat,所以请记得import进来! 用法: SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 这一行最重要,它确立了转换的格式,yyyy是完整的西元年,MM是月份,dd是日期, 至於HH:mm:ss就不需要我再解释了吧! ps:为什麽有的格式大写,有的格式小写,那是怕避免混淆,例如MM是月份,mm是分;HH是24小时制,而hh是12小时制 1.字串转日期:  2002-10-8 15:30:22要把它转成日期,可以用  Date date=sdf.parse("2002-10-8 15:30:22"); 2.日期转字串  假如把今天的日期转成字串可用  String datestr=sdf.format(new Date());  这个字串的内容便类似2002-10-08 14:55:38 透过这个API我们便可以随心所欲的将日期转成我们想要的字串格式,例如希望将日期输出成2002年10月08日, 我们可以这麽写: SimpleDateFormat sdf=new SimpleDateFormat("yyyy年MM月dd日"); String datestr=sdf.format(new Date()); datestr便会依照我们设定的格式输出 //对日期格式的转换成("yyyy-MM-dd")格式的方法 public java.sql.Date Convert(String str) { java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd"); try { java.util.Date d = sdf.parse(str); java.sql.Date d1 = new java.sql.Date(d.getTime()); return d1; } catch(Exception ex) { ex.printStackTrace(); return null; } } 应用如下: ctmt.setDate(7,this.Convert(info.getManBirth())); // @DATETIME 常用日期问题集锦 1、获取服务器端当前日期: %@ page import="java.util.Date"% % Date myDate = new Date(); % 2、获取当前年、月、日: %@ page import="java.util.Date"% % Date myDate = new Date(); int thisYear = myDate.getYear() + 1900;//thisYear = 2003 int thisMonth = myDate.getMonth() + 1;//thisMonth = 5 int thisDate = myDate.getDate();//thisDate = 30 % 3、按本地时区输出当前日期 %@ page import="java.util.Date"% % Date myDate = new Date(); out.println(myDate.toLocaleString()); % 输出结果为: 2003-5-30 4、获取数据库中字段名为”publish_time“、类型为Datetime的值 %@ page import="java.util.Date"% % ...连接数据库... ResultSet rs = ... Date sDate = rs.getDate("publish_time"); % 5、按照指定格式打印日期 %@ page import="java.util.Date"% %@ page import="java.text.DateFormat"% % Date dNow = new Date(); SimpleDateFormat formatter = new SimpleDateFormat("E yyyy.MM.dd 'at' hh:mm:ss a zzz"); out.println("It is " + formatter.format(dNow)); % 输出的结果为: It is 星期五 2003.05.30 at 11:30:46 上午 CST (更为详尽的格式符号请参看SimpleDateFormat类) 6、将字符串转换为日期 %@ page import="java.util.Date"% %@ page import="java.text.DateFormat"% % String input = "1222-11-11"; SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); Date t = null; try{ t = formatter.parse(input); out.println(t); }catch(ParseException e){ out.println("unparseable using " + formatter); } % 输出结果为: Fri Nov 11 00:00:00 CST 1222 7、计算日期之间的间隔 %@ page import="java.util.Date"% %@ page import="java.text.DateFormat"% % String input = "2003-05-01"; SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); Date d1 = null; try{ d1 = formatter.parse(input); }catch(ParseException e){ out.println("unparseable using " + formatter); } Date d2 = new Date(); long diff = d2.getTime() - d1.getTime(); out.println("Difference is " + (diff/(1000*60*60*24)) + " days."); % 输出结果为: Difference is 29 days. 8、日期的加减运算 方法:用Calendar类的add()方法 %@ page import="java.util.*"% %@ page import="java.text.*"% % Calendar now = Calendar.getInstance(); SimpleDateFormat formatter = new SimpleDateFormat("E yyyy.MM.dd 'at' hh:mm:ss a zzz"); out.println("It is now " + formatter.format(now.getTime())); now.add(Calendar.DAY_OF_YEAR,-(365*2)); out.println("br"); out.println("Two years ago was " + formatter.format(now.getTime())); % 输出结果为: It is now 星期五 2003.05.30 at 01:45:32 下午 CST Two years ago was 星期三 2001.05.30 at 01:45:32 下午 CST 9、比较日期 方法:用equals()、before()、after()方法 %@ page import="java.util.*"% %@ page import="java.text.*"% % DateFormat df = new SimpleDateFormat("yyy-MM-dd"); Date d1 = df.parse("2000-01-01"); Date d2 = df.parse("1999-12-31"); String relation = null; if(d1.equals(d2)) relation = "the same date as"; else if(d1.before(d2)) relation = "before"; else relation = "after"; out.println(d1 +" is " + relation + ' ' + d2); % 输出结果为: Sat Jan 01 00:00:00 CST 2000 is after Fri Dec 31 00:00:00 CST 1999 10、记录一件事所花费的时间 方法:调用两次System.getTimeMillis()方法,求差值 %@ page import="java.text.*"% % long t0,t1; t0 = System.currentTimeMillis(); out.println("Cyc starts at " + t0); int k = 0; for(int i =0;i100000;i++){ k += i; } t1 = System.currentTimeMillis(); out.println("br"); out.println("Cyc ends at " + t1); out.println("br"); out.println("This run took " + (t1-t0) + "ms."); % 输出结果为: Cyc starts at 1054275312432 Cyc ends at 1054275312442 This run took 10ms. 其它:如何格式化小数 %@ page import="java.text.*"% % DecimalFormat df = new DecimalFormat(",###.00"); double aNumber = 33665448856.6568975; String result = df.format(aNumber); out.println(result); % 输出结果为: 33,665,448,856.66 ====================== 日期比较: 在JAVA中日期的计算与比较可以使用Date和DateFormat来解决,下面是一段示例代码: import java.text.*; import java.util.*; public class Test{  public static void main(String[] args){   try{    Date date=new Date();    DateFormat df=DateFormat.getDateTimeInstance();    String now=df.format(date);    System.out.println("现在时间:"+now);    System.out.println("现在时间是否在16:00之前:"+date.before(df.parse("2004-12-24 16:00:00")));   }   catch(ParseException e){System.out.print(e.getMessage());   }  } }
个人分类: java|1947 次阅读|0 个评论
[转载]Date Object Methods
lizhiguo 2013-7-16 11:25
Date Object Methods 日期对象方法 FF : Firefox, N : Netscape, IE : Internet Explorer FF:火狐,N:网景,IE Method 方法 Description 描述 FF N IE Date() Returns today's date and time 返回今天的日期和时间 1 2 3 getDate() Returns the day of the month from a Date object (from 1-31) 返回月中的第几天(1到31) 1 2 3 getDay() Returns the day of the week from a Date object (from 0-6) 返回一周中的第几天(0到6) 1 2 3 getMonth() Returns the month from a Date object (from 0-11) 返回月份数(0到11) 1 2 3 getFullYear() Returns the year, as a four-digit number, from a Date object 返回完整的年份数 1 4 4 getYear() Returns the year, as a two-digit or a four-digit number, from a Date object. Use getFullYear() instead !! 返回年份,可以是两位的或是四位的 1 2 3 getHours() Returns the hour of a Date object (from 0-23) 返回日期对象的小时数(0到23) 1 2 3 getMinutes() Returns the minutes of a Date object (from 0-59) 返回日期对象的分钟(0到59) 1 2 3 getSeconds() Returns the seconds of a Date object (from 0-59) 返回日期对象的秒(0到59) 1 2 3 getMilliseconds() Returns the milliseconds of a Date object (from 0-999) 返回毫秒(0到999) 1 4 4 getTime() Returns the number of milliseconds since midnight Jan 1, 1970 从1970年1月1号午夜到现在一共花去的毫秒数 1 2 3 getTimezoneOffset() Returns the difference in minutes between local time and Greenwich Mean Time (GMT) 本地时间和GMT相差多少分钟 1 2 3 getUTCDate() Returns the day of the month from a Date object according to universal time (from 1-31) 依据国际时间来得到月中的第几天(1到31) 1 4 4 getUTCDay() Returns the day of the week from a Date object according to universal time (from 0-6) 依据国际时间来得到现在是星期几(0到6) 1 4 4 getUTCMonth() Returns the month from a Date object according to universal time (from 0-11) 依据国际时间来得到月份(0到11) 1 4 4 getUTCFullYear() Returns the four-digit year from a Date object according to universal time 依据国际时间来得到完整的年份 1 4 4 getUTCHours() Returns the hour of a Date object according to universal time (from 0-23) 依据国际时间来得到小时(0-23) 1 4 4 getUTCMinutes() Returns the minutes of a Date object according to universal time (from 0-59) 依据国际时间来返回分钟(0到59) 1 4 4 getUTCSeconds() Returns the seconds of a Date object according to universal time (from 0-59) 依据国际时间来返回秒(0到59) 1 4 4 getUTCMilliseconds() Returns the milliseconds of a Date object according to universal time (from 0-999) 依据国际时间来返回毫秒(0到999) 1 4 4 parse() Takes a date string and returns the number of milliseconds since midnight of January 1, 1970 或得并返回自1970年1月1号凌晨到现在一共花掉了多少毫秒 1 2 3 setDate() Sets the day of the month in a Date object (from 1-31) 设置日 1 2 3 setMonth() Sets the month in a Date object (from 0-11) 设置月 1 2 3 setFullYear() Sets the year in a Date object (four digits) 设置年份 1 4 4 setYear() Sets the year in the Date object (two or four digits). Use setFullYear() instead !! 用setFullYear()来取代 1 2 3 setHours() Sets the hour in a Date object (from 0-23) 设置小时 1 2 3 setMinutes() Set the minutes in a Date object (from 0-59) 设置分钟 1 2 3 setSeconds() Sets the seconds in a Date object (from 0-59) 设置秒 1 2 3 setMilliseconds() Sets the milliseconds in a Date object (from 0-999) 设置毫秒 1 4 4 setTime() Calculates a date and time by adding or subtracting a specified number of milliseconds to/from midnight January 1, 1970 1 2 3 setUTCDate() Sets the day of the month in a Date object according to universal time (from 1-31) 依据国际时间来设置日期 1 4 4 setUTCMonth() Sets the month in a Date object according to universal time (from 0-11) 依据国际时间来设置月 1 4 4 setUTCFullYear() Sets the year in a Date object according to universal time (four digits) 依据国际时间来设置年份 1 4 4 setUTCHours() Sets the hour in a Date object according to universal time (from 0-23) 依据国际时间来设置小时 1 4 4 setUTCMinutes() Set the minutes in a Date object according to universal time (from 0-59) 依据国际时间来设置分钟 1 4 4 setUTCSeconds() Set the seconds in a Date object according to universal time (from 0-59) 依据国际时间来设置秒 1 4 4 setUTCMilliseconds() Sets the milliseconds in a Date object according to universal time (from 0-999) 依据国际时间来设置毫秒 1 4 4 toSource() Represents the source code of an object 显示对象的源代码 1 4 - toString() Converts a Date object to a string 将日期对象转换为字符串 1 2 4 toGMTString() Converts a Date object, according to Greenwich time, to a string. Use toUTCString() instead !! 根据格林威治时间将Date 对象转换为一个字符串。可以使用toUTCString()替代这种方法 1 2 3 toUTCString() Converts a Date object, according to universal time, to a string 根据通用时间将一个Date 对象转换为一个字符串 1 4 4 toLocaleString() Converts a Date object, according to local time, to a string 根据本地时间将一个Date 对象转换为一个字符串 1 2 3 UTC() Takes a date and returns the number of milliseconds since midnight of January 1, 1970 according to universal time 根据通用时间将日期计算为从1970年1月1日午夜至今所经过的时间(单位:毫秒) 1 2 3 valueOf() Returns the primitive value of a Date object 返回日期对象的原始值 1 2 4
个人分类: 计算机技术|1530 次阅读|0 个评论
DirSync Pro, a powerful and free file sync tool
albumns 2012-11-23 18:53
DirSync Pro, a powerful and free file sync tool
Here Irecommenda free file sync tool:DirSync Pro which works under Linux, Windows and macOS. Although it based on JAVA, it is stillamazingfast when sync files between local disk and USB hard disk. Download link: http://www.dirsyncpro.org/download.html DirSync Pro is designed and developed by O. Givi. DirSync Pro is based on DirSync (Directory Synchronize) by E. Gerber and F. Gerbig. (C) 2008-2012 O. Givi (C) 2002-2008 by E. Gerber, F. Gerbig and T. Groetzner. Thanks to M. Lux, G. Noorlander, T. Brixel, D. Caravana, R. Williams, and D. Petre. This program comes with ABSOLUTELY NO WARRANTY; It is licensed according to GPL v3. Features Synchronization Powerful synchronization algorithm. Bi-directional (Two way) and mono-directional (One way) synchronization mode. Predefined synchronzation modes for mostly used synchronizations Mirror A - B (incremental): Mirrors new and modified files from A to B. Mirror B - A (incremental): Mirrors new and modified files from B to A. Synchronize A - B (incremental): Mirrors new and modified files in directories A and B to each other. Backup A - B (full): Makes a full copy of directory A into directory B. Restore B - A (full): Makes a full copy of directory B into directory A. Contribute A - B (incremental): Mirrors only new files from directory A into directory B. Contribute B - A (incremental): Mirrors only the new files from directory B into directory A. Synchronize A - B (custom): Custom mode to synchronize directory A into directory B with all advanced options. Synchronize B - A (custom): Custom mode to synchronize directory B into directory A with all advanced options. Highly customizable custom synchronization modes. Option for various behavior of conflict resolution for Bidirectional Synchronization. Synchronizes unlimited number of files and folders. Large number of options to change the synchronization behavior. Option to synchonise subdirectories recursively. Synchronizes files/folders any file system (FAT, FAT16, FAT32, NTFS, WinFS, UDF, Ext2, Ext3, ...). Synchronizes files from/to network drives Synchronizes files from/to any mounted devices (Harddisks, USB-Sticks, Memory cards, External drives, CD/DVD's, ...). Synchronization could be used for making incremental backups. Option to create up to 50 backups from the modified/changed files before synchronization. Option to define a backup folder where DirSync Pro keeps tracks of files which are being overwritten. Option for handling symbolic links. Advanced options for handling time-stamps. Option to define timestamp granularity. Option to handle 'daylight saving' related timestamp granularity (useful when syncing with FAT file systems). Option to preserve DOS attributes when synchoronizing (DOS/Windows only). Option to preserve file ownerships (user and group, POSIX only). Option to preserve file permissions (POSIX systems only). Schedule Engine DirSync Pro has a powerful Schedule Engine with lots of features to run automated scheduled synchronzation tasks. Once: Run sync tasks at a certain time in the future. Minutely: Run sync tasks recurrently every X minutes. Hourly: Run sync tasks recurrently every X hours. Daily: Run sync tasks recurrently on a certain time daily. Weekly: Run sync tasks recurrently on a certain time and in specific months every X weeks. Monthly: Run sync tasks recurrently every month on day number X, on a certain time and in specific months. Filters DirSync Pro has comprehensive filters to include or exclude files and directories. The user can set up a combination of unlimited number of filters of the following types: Filter based on string patterns in file/directory names. Filter based on file sizes. (smaller than, equal, larger than). Filter based on modification dates (earlier than, on a date, later than). Filter based on an absoulte path. Filter based on DOS attibutes (DOS/MS Windows only). Filter based on file ownerships (user and group, POSIX only). Filter based on file permissions (POSIX systems only). General Easy, clear and user-friendly graphical user interface, no unnecessary gadget you never use. Runs on every modern operating system including Windows™, Linux™ and Macintosh™ It is Portable! It does not need any installation. Just run the application! Open source, it is 100% free of charge, 100% free of commercial text, 100% free of advertisements and 100% free of spyware. No time/function limitations Uses no local database, so no overhead Does not need any installation. Just download and run it. You can put it on you USB-stick en you can run it on any computer/any platform. Does not copy your files to a server on internet to synchronize your data. In this way you are totally in charge of your data. Lets your create a command line and save it to a batch file to run a synchronization with one mouse click or in a batch. Logging Advanced logging/reporting facilities. Just select a log level and define where to write the log. Option to log on application level (default log) Option to log on each directory level (dir log) Option to define the log leven (how much to log)
个人分类: Linux相关|4887 次阅读|0 个评论
A unique day: 10/11/12
zuojun 2012-10-12 08:00
At least for people who live in the US...
个人分类: Tea Time/Coffee Break|2404 次阅读|0 个评论
linux输出时间
shengxianlei06 2011-12-7 03:04
文件名:date.sh 内容如下: #------------------------- #!/bin/bash while read x do echo " $x" done #---------------------------
个人分类: shell编程|2610 次阅读|0 个评论
Modified Julian Day与年月日时分秒转换C++和MATLAB代码
热度 7 zjwang 2010-3-30 14:47
C++转换函数: 年月日时分秒(支持小数秒)与ModifiedJulianDay互转 doubleYmdToMjd(intiYear,intiMonth,intiDay,intiHour,intiMin,doubledSec); voidMJdToYmd(doubledMJD,int*piYear,int*piMonth,int*piDay,int*piHour, int*piMin,double*pdSec); MATLAB转换函数: 年月日时分秒(支持小数秒)与ModifiedJulianDay互转 mjd--ModifiedJulianDay,可输入数组 functiongreDate=wzjMjdToGregorianDate(mjd) greDate---年月日时分秒向量,可输入数组 functionmjd=wzjGregorianDateToMjd(greDate) UTC与当地时互转 utcArr--UTC,可输入数组 functionLT=wzjUTCToLT(utcArr,lonArr) lonArr--当地经度(0~360或-180~180均可),可输入数组 functionUTC=wzjLTToUTC(ltArr,lonArr) ModifiedJulianDay 年月 日 时分秒 54783.531115407120081113124448.3712005615234 54783.531144339320081113124450.8709030151367 54783.531172548220081113124453.3081970214844 54783.531200757120081113124455.7453994750977 54783.531229689420081113124458.2452011108398 54783.53125789832008111312450.682403564453125 54783.53128683052008111312453.18219757080078 54783.53131503942008111312455.61940002441406 54783.53134397162008111312458.11920166015625 54783.531372180520081113124510.5563964843750 54783.531401112720081113124513.0560989379883 54783.531429321620081113124515.4934005737305 54783.531457530520081113124517.9306030273438 54783.531486462820081113124520.4303970336914 54783.531514671720081113124522.8675994873047 54783.531543603920081113124525.3674011230469 54783.531571812820081113124527.8046035766602 54783.531600021720081113124530.2418975830078 54783.531628953920081113124532.7416000366211 54783.531657162820081113124535.1789016723633 54783.531686095020081113124537.6785964965820 54783.531714304020081113124540.1158981323242 54783.531743236220081113124542.6156005859375 54783.531771445120081113124545.0529022216797 54783.531799654020081113124547.4900970458984 54783.531828586220081113124549.9898986816406 54783.531856795120081113124552.4271011352539 54783.531885727320081113124554.9268035888672 54783.531913936220081113124557.3640975952148 54783.531942145120081113124559.8013992309570 请需要的留下邮箱及语言类型。
个人分类: 计算程序|16371 次阅读|13 个评论

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-4-27 08:55

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部