📄 dates.hlp
字号:
{smcl}
{* 05apr2005}{...}
{cmd:help dates}
{hline}
{title:Title}
{pstd}
{hi:[U] 24 Dealing with dates}
{title:Remarks}
{pstd}Stata's {cmd:%d} format maps integers onto dates:
{center: ... }
{center:-15,000 corresponds to 01dec1918}
{center: ... }
{center: -31 corresponds to 01dec1959}
{center: ... }
{center: -1 corresponds to 31dec1959}
{center: 0 corresponds to 01jan1960}
{center: 1 corresponds to 02jan1960}
{center: ... }
{center: 31 corresponds to 01feb1960}
{center: ... }
{center: 15,000 corresponds to 25jan2001}
{center: ... }
{pstd}
If you subtract two dates (meaning the corresponding integers), you obtain
the number of days between dates:
{center:01feb1960 - 02jan1960 = 31-1 = 30}
{pstd}
Stata provides functions to convert strings containing "01feb1960" or
"February 1, 1960", etc., to dates and other functions to manipulate dates.
See
{p2colset 9 20 22 2}{...}
{p2col :{help datefcn}}Inputting
dates (translating dates from strings){p_end}
{p2col :{help mdyfcn}}Creating
dates from month, day, and year{p_end}
{p2col :{help dfcn}}Typing fixed dates in expressions{p_end}
{p2col :{help dexfcns}}Extracting
month, day, year, etc., from a date{p_end}
{p2col :{help dfmt}}Details of the {cmd:%d} date format{p_end}
{p2col :{help tdates}}Additional
time-series date formats supported by Stata{p_end}
{pstd}
Note: after creating a date variable, use the {helpb format} command to
place the {cmd:%d} format on the variable.
{cmd:. generate mydate =} {it:...}
{cmd:. format mydate %d}
{title:Also see}
{psee}
Manual: {bf:[U] 12.5.3 Date formats},{break}
{bf:[U] 24 Dealing with dates},{break}
{bf:[U] 24.2 Dates}
{psee}
Online: {help tdates};
{helpb format};
{help datefcn},
{help dexfcns},
{help dfcn},
{help dfmt},
{help mdyfcn}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -