亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

Chinaunix

標題: 知道日期/星期,不知道年份,求助 [打印本頁]

作者: volwang    時間: 2014-08-04 21:25
標題: 知道日期/星期,不知道年份,求助
時間求助:
已知一段文本:
Mon Aug   4  16:02:50   
Fri    Mar  22 17:14:41
Tue Oct   23 18:38:49   
。。。

不知道每列年份是多少,只知道這幾個時間發(fā)生在[2012,2014]年之間,希望把年份添加到每類的后面
得到的結(jié)果是:
Mon Aug   4  16:02:50     2014
Fri    Mar  22 17:14:41     2013
Tue Oct   23 18:38:49      2012
。。。                             。。。

特求助。





作者: volwang    時間: 2014-08-04 21:45
本帖最后由 volwang 于 2014-08-04 21:46 編輯

可能出現(xiàn)的日期簡寫:
星期一: Mon
星期二: Tue
星期三:Wed
星期四:Thu
星期五:  Fri
星期六:  Sat
星期天: Sun

一  月:Jan
二  月:Feb
三  月:Mar
四  月:Apr
五  月:May
六  月:Jun
七  月:Jul
八  月:Aug
九  月:Sep
十  月:Oct
十一月:Nov
十二月:Dec


作者: jason680    時間: 2014-08-04 21:46
本帖最后由 jason680 于 2014-08-04 21:54 編輯

回復 1# volwang

1. to get weekday idea
  date -d " Aug 4 2012 16:02:50" +%a

2. awk implement
  cmd="shell command"
  cmd | getline w
  close(cmd)

$ awk -vs=" " '{for(n=2012;n<=2014;n++){cmd="date -d \""$2s$3s n s$4"\" +%a" ;cmd|getline w;close(cmd);if(w==$1){print $0"\t"n;next}}}' FILE
Mon Aug   4 16:02:50           2014
Fri Mar  22 17:14:41        2013
Tue Oct  23 18:38:49        2012

   
作者: volwang    時間: 2014-08-04 21:48
相同日期,星期  ,不同的年份,重復的概率有多大。要是把范圍放大,代碼是不是可能出錯

作者: yestreenstars    時間: 2014-08-04 22:29
回復 3# jason680

這頭像好牛X~
   
作者: q1208c    時間: 2014-08-05 08:19
回復 4# volwang
是的. 會有很大的重復率.

所以, 我真心覺得, 靠猜來解決問題不是辦法. 你最好能找到更合適的辦法.

   
作者: Shell_HAT    時間: 2014-08-05 08:49
The 400-year cycle of the Gregorian calendar has 146,097 days and hence exactly 20,871 weeks. So, for example, the days of the week in Gregorian 1603 were exactly the same as for 2003. The years that are divisible by 400 begin on a Saturday. In the 400-year cycle, more months begin on a Sunday (and hence have Friday the 13th) than any other day of the week (see above under Week for a more detailed explanation of how this happens). 688 out of every 4800 months (or 172/1200) begin on a Sunday, while only 684 out of every 4800 months (171/1200) begin on each of Saturday and Monday, the least common cases.

A smaller cycle is 28 years (1,461 weeks), provided that there is no dropped leap year in between. Days of the week in years may also repeat after 6, 11, 12, 28 or 40 years. Intervals of 6 and 11 are only possible with common years, while intervals of 28 and 40 are only possible with leap years. An interval of 12 years only occurs with common years when there is a dropped leap year in between.




歡迎光臨 Chinaunix (http://72891.cn/) Powered by Discuz! X3.2