西暦からユリウス日を計算
*サンプル
-----------------------------------------------------------------------
#N88BASIC
'構造体
Type ASTRODATE
dy as integer '年
dm as integer '月
dd as integer '日
th as integer '時
tm as integer '分
ts as integer '秒
end Type
'西暦テスト変数入力
Sub DoubleDateInput(ByRef A As ASTRODATE)
A.dy=1990
A.dm=7
A.dd=1
A.th=9
A.tm=0
A.ts=00
End Sub
'西暦からユリウス日を計算
'
'
'関数の引数:
' jdy - 年 [単位:西暦年]
' jdm - 月 [単位:月]
' jdd - 日 [単位:日]
' jth - 時 [単位:時]
' jtm - 分 [単位:分]
' jts - 秒
'
'
Function GetAstroDateA(jdy,jdm,jdd,jth,jtm,jts) As Double
dim jdo As Double
dim jd_jst As Double
dim dy As Double
dim dm As Double
dim dd As Double
dim th As Double
dim tm As Double
dim ts As Double
'
dy=jdy
dm=jdm
dd=jdd
th=jth
tm=jtm
ts=jts
'0時におけるユリウス日
if(dm<3) then
dm=dm+12
dy=dy-1
end if
jdo = Fix(dy / 100)
jd_jst = Fix(dy * 365.25) -jdo + Fix(jdo / 4)
jd_jst = jd_jst + Fix(30.6001 * (tm + 1)) + dd + th / 24 + tm / 1440 + 1720996.5
jd_jst = jd_jst - 9/24
GetAstroDateA = jd_jst
End Function
'メイン
dim a as ASTRODATE
dim b as Double
DoubleDateInput(a)
print a.dy,a.dm,a.dd
b = GetAstroDateA(a.dy,a.dm,a.dd,a.th,a.tm,a.ts)
print b
-----------------------------------------------------------------------
*サンプル
-----------------------------------------------------------------------
#N88BASIC
'構造体
Type ASTRODATE
dy as integer '年
dm as integer '月
dd as integer '日
th as integer '時
tm as integer '分
ts as integer '秒
end Type
'西暦テスト変数入力
Sub DoubleDateInput(ByRef A As ASTRODATE)
A.dy=1990
A.dm=7
A.dd=1
A.th=9
A.tm=0
A.ts=00
End Sub
'西暦からユリウス日を計算
'
'
'関数の引数:
' jdy - 年 [単位:西暦年]
' jdm - 月 [単位:月]
' jdd - 日 [単位:日]
' jth - 時 [単位:時]
' jtm - 分 [単位:分]
' jts - 秒
'
'
Function GetAstroDateA(jdy,jdm,jdd,jth,jtm,jts) As Double
dim jdo As Double
dim jd_jst As Double
dim dy As Double
dim dm As Double
dim dd As Double
dim th As Double
dim tm As Double
dim ts As Double
'
dy=jdy
dm=jdm
dd=jdd
th=jth
tm=jtm
ts=jts
'0時におけるユリウス日
if(dm<3) then
dm=dm+12
dy=dy-1
end if
jdo = Fix(dy / 100)
jd_jst = Fix(dy * 365.25) -jdo + Fix(jdo / 4)
jd_jst = jd_jst + Fix(30.6001 * (tm + 1)) + dd + th / 24 + tm / 1440 + 1720996.5
jd_jst = jd_jst - 9/24
GetAstroDateA = jd_jst
End Function
'メイン
dim a as ASTRODATE
dim b as Double
DoubleDateInput(a)
print a.dy,a.dm,a.dd
b = GetAstroDateA(a.dy,a.dm,a.dd,a.th,a.tm,a.ts)
print b
-----------------------------------------------------------------------
- ActiveBasicオフィシャルユーザーズガイド―完全FreeのBasic統合開発環境で始めるWindowsプログラミング/山本 大祐

- ¥2,625
- Amazon.co.jp