2020年9月20日日曜日

Juliaの日時処理

Juliaによる日時処理の練習をしてみた。 
日曜日の誕生日は11回目だ。生まれてからまだ2万4427日しかたっていなかった。

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
using Dates
daytoday = today()
birthday = Date(1953,9,20)
println(daytoday," ",isleapyear(daytoday))
println(yearmonthday(birthday)," ",isleapyear(birthday)) 
println(yearmonth(birthday)," ",monthday(birthday)) 
println(daysofweekinmonth(birthday)," ",dayofweekofmonth(birthday)) 
println(monthname(birthday)) 
println(dayofweek(birthday)," ",dayname(birthday)) 
println(daytoday-birthday) 

function bd()
  for i in 1953:2020
    k=Date(i,9,20)
    kk=dayname(k)
    age=i-1953
    star=""
    if(kk == "Sunday")
      star="*"
    end
    println(k," ",age," ",kk," ",star)
  end
end

bd()
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

2020-09-20 true
(1953, 9, 20) false
(1953, 9) (9, 20)
4 3
September
7 Sunday
24472 days
1953-09-20 0 Sunday *
1954-09-20 1 Monday 
1955-09-20 2 Tuesday 
1956-09-20 3 Thursday 
1957-09-20 4 Friday 
1958-09-20 5 Saturday 
1959-09-20 6 Sunday *
1960-09-20 7 Tuesday 
1961-09-20 8 Wednesday 
1962-09-20 9 Thursday 
1963-09-20 10 Friday 
1964-09-20 11 Sunday *
1965-09-20 12 Monday 
1966-09-20 13 Tuesday 
1967-09-20 14 Wednesday 
1968-09-20 15 Friday 
1969-09-20 16 Saturday 
1970-09-20 17 Sunday *
1971-09-20 18 Monday 
1972-09-20 19 Wednesday 
1973-09-20 20 Thursday 
1974-09-20 21 Friday 
1975-09-20 22 Saturday 
1976-09-20 23 Monday 
1977-09-20 24 Tuesday 
1978-09-20 25 Wednesday 
1979-09-20 26 Thursday 
1980-09-20 27 Saturday 
1981-09-20 28 Sunday *
1982-09-20 29 Monday 
1983-09-20 30 Tuesday 
1984-09-20 31 Thursday 
1985-09-20 32 Friday 
1986-09-20 33 Saturday 
1987-09-20 34 Sunday *
1988-09-20 35 Tuesday 
1989-09-20 36 Wednesday 
1990-09-20 37 Thursday 
1991-09-20 38 Friday 
1992-09-20 39 Sunday *
1993-09-20 40 Monday 
1994-09-20 41 Tuesday 
1995-09-20 42 Wednesday 
1996-09-20 43 Friday 
1997-09-20 44 Saturday 
1998-09-20 45 Sunday *
1999-09-20 46 Monday 
2000-09-20 47 Wednesday 
2001-09-20 48 Thursday 
2002-09-20 49 Friday 
2003-09-20 50 Saturday 
2004-09-20 51 Monday 
2005-09-20 52 Tuesday 
2006-09-20 53 Wednesday 
2007-09-20 54 Thursday 
2008-09-20 55 Saturday 
2009-09-20 56 Sunday *
2010-09-20 57 Monday 
2011-09-20 58 Tuesday 
2012-09-20 59 Thursday 
2013-09-20 60 Friday 
2014-09-20 61 Saturday 
2015-09-20 62 Sunday *
2016-09-20 63 Tuesday 
2017-09-20 64 Wednesday 
2018-09-20 65 Thursday 
2019-09-20 66 Friday 
2020-09-20 67 Sunday *

0 件のコメント: