# Wolfram 语言™

## 转换到玛雅历法

In[1]:=
```epoch = JulianDate["Modified", DateObject[{-3114, 8, 11}, TimeZone -> 0]];```

In[2]:=
```JulianFromMayanLongCount[{baktun_, katun_, tun_, uinal_, kin_}] := epoch + 144000*baktun + 7200*katun + 360*tun + 20*uinal + kin```

FromJulianDate 可用于测试范例输入.

In[3]:=
`example = JulianFromMayanLongCount[{7, 17, 18, 19, 2}]`
Out[3]=
In[4]:=
`FromJulianDate["Modified", example, TimeZone -> 0]`
Out[4]=

In[5]:=
```GregorianFromMayanLongCount[date_] := DateValue[ FromJulianDate["Modified", JulianFromMayanLongCount[date], TimeZone -> 0], "Day", DateObject]```
In[6]:=
`GregorianFromMayanLongCount[{7, 17, 18, 19, 2}]`
Out[6]=

In[7]:=
```JulianToMayanLongCount[date_] := NumberDecompose[ Floor[date - epoch], {144000, 7200, 360, 20, 1} ]```

JulianDate 可用于诠释任何日期转换为儒略日期，然后数据填充进 JulianToMayanLongCount.

In[8]:=
```DateToMayanLongCount[date_] := Block[{\$TimeZone = 0}, JulianToMayanLongCount[JulianDate["Modified", date]] ]```

In[9]:=
`DateToMayanLongCount["May 4th, 2015"]`
Out[9]=
In[10]:=
`DateToMayanLongCount[AbsoluteTime[]]`
Out[10]=
In[11]:=
`DateToMayanLongCount[Today]`
Out[11]=

In[12]:=
`DateToMayanLongCount[{1900, 1, 1}]`
Out[12]=
In[13]:=
```DateToMayanLongCount[{1900, 1, 1}]; GregorianFromMayanLongCount[%]```
Out[13]=