This file is indexed.

/usr/share/doc/pyxplot/html/sect0052.html is in pyxplot-doc 0.9.2-4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta name="generator" content="plasTeX" />
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<title>PyXPlot Users' Guide: Dates</title>

<link href="sect0053.html" title="Modules and classes" rel="next" />
<link href="sect0051.html" title="Color representations of the electromagnetic spectrum" rel="prev" />
<link href="chap-progDataTypes.html" title="Programming: Pyxplot’s data types" rel="up" />
<link rel="stylesheet" href="styles/styles.css" />
</head>
<body>

<div class="navigation">
<table cellspacing="2" cellpadding="0" width="100%">
<tr>
<td><a href="sect0051.html" title="Color representations of the electromagnetic spectrum"><img alt="Previous: Color representations of the electromagnetic spectrum" border="0" src="icons/previous.gif" width="32" height="32" /></a></td>

<td><a href="chap-progDataTypes.html" title="Programming: Pyxplot’s data types"><img alt="Up: Programming: Pyxplot’s data types" border="0" src="icons/up.gif" width="32" height="32" /></a></td>

<td><a href="sect0053.html" title="Modules and classes"><img alt="Next: Modules and classes" border="0" src="icons/next.gif" width="32" height="32" /></a></td>

<td class="navtitle" align="center">PyXPlot Users' Guide</td>
<td><a href="index.html" title="Table of Contents"><img border="0" alt="" src="icons/contents.gif" width="32" height="32" /></a></td>

<td><a href="sect0288.html" title="Index"><img border="0" alt="" src="icons/index.gif" width="32" height="32" /></a></td>

<td><img border="0" alt="" src="icons/blank.gif" width="32" height="32" /></td>
</tr>
</table>
</div>

<div class="breadcrumbs">
<span>
<span>
<a href="index.html">PyXPlot Users' Guide</a> <b>:</b>
</span>

</span><span>
<span>
<a href="sect0001.html">Introduction to PyXPlot</a> <b>:</b>
</span>

</span><span>
<span>
<a href="chap-progDataTypes.html">Programming: Pyxplot’s data types</a> <b>:</b>
</span>

</span><span>

<span>
<b class="current">Dates</b>
</span>
</span>
<hr />
</div>

<div><h1 id="a0000000053">6.7 Dates</h1>
<p>Pyxplot has a <tt class="tt">date</tt> object type which simplifies the process of working with dates and times. Pyxplot provides a range of pre-defined functions, in the <tt class="tt">time</tt> module, for creating and manipulating <tt class="tt">date</tt> objects. The functions for creating <tt class="tt">date</tt> objects are as follows: </p><p>   <big class="large"><b class="bf">time.fromCalendar(<img src="images/img-0303.png" alt="$year,month,day,hour,min,sec$" style="vertical-align:-4px; 
                                     width:252px; 
                                     height:17px" class="math gen" />)</b></big> <br />The time.fromCalendar(<img src="images/img-0303.png" alt="$year,month,day,hour,min,sec$" style="vertical-align:-4px; 
                                     width:252px; 
                                     height:17px" class="math gen" />) function creates a date object from the specified calendar date. It takes six inputs: the year, the month number (1–12), the day of the month (1–31), the hour of day (0–24), the number of minutes (0–59), and the number of seconds (0–59). To enter dates before <small class="footnotesize">AD</small> 1, a year of <img src="images/img-0155.png" alt="$0$" style="vertical-align:0px; 
                                     width:9px; 
                                     height:12px" class="math gen" /> should be passed to indicate 1 <small class="footnotesize">BC</small>, <img src="images/img-0156.png" alt="$-1$" style="vertical-align:0px; 
                                     width:21px; 
                                     height:12px" class="math gen" /> should be passed to indicate the year 2 <small class="footnotesize">BC</small>, and so forth. The <tt class="ttfamily">set calendar</tt> command is used to change the current calendar. <a name="a0000000622" id="a0000000622"></a>  </p><p>    <big class="large"><b class="bf">time.fromJD(<img src="images/img-0065.png" alt="$t$" style="vertical-align:0px; 
                                     width:6px; 
                                     height:12px" class="math gen" />)</b></big> <br />The time.fromJD(<img src="images/img-0065.png" alt="$t$" style="vertical-align:0px; 
                                     width:6px; 
                                     height:12px" class="math gen" />) function creates a date object from the specified numerical Julian date. <a name="a0000000623" id="a0000000623"></a>  </p><p>    <big class="large"><b class="bf">time.fromMJD(<img src="images/img-0065.png" alt="$t$" style="vertical-align:0px; 
                                     width:6px; 
                                     height:12px" class="math gen" />)</b></big> <br />The time.fromMJD(<img src="images/img-0065.png" alt="$t$" style="vertical-align:0px; 
                                     width:6px; 
                                     height:12px" class="math gen" />) function creates a date object from the specified numerical modified Julian date. <a name="a0000000624" id="a0000000624"></a>  </p><p>    <big class="large"><b class="bf">time.fromUnix(<img src="images/img-0065.png" alt="$t$" style="vertical-align:0px; 
                                     width:6px; 
                                     height:12px" class="math gen" />)</b></big> <br />The time.fromUnix(<img src="images/img-0065.png" alt="$t$" style="vertical-align:0px; 
                                     width:6px; 
                                     height:12px" class="math gen" />) function creates a date object from the specified numerical Unix time. <a name="a0000000625" id="a0000000625"></a>  </p><p>    <big class="large"><b class="bf">time.now()</b></big> <br />The time.now() function creates a date object representing the present time. <a name="a0000000626" id="a0000000626"></a>  </p><p>The following example creates a date object representing midnight on 1st January 2000: </p><p> <tt class="ttfamily">pyxplot&gt; <b class="bfseries">print time.fromCalendar(2000,1,1,0,0,0)</b></tt><br /><tt class="ttfamily">Sat 2000 Jan 1 00:00:00 UTC</tt><br /><tt class="ttfamily">pyxplot&gt; <b class="bfseries">a = time.fromCalendar(2000,1,1,0,0,0,"Australia/Perth")</b></tt><br /><tt class="ttfamily">pyxplot&gt; <b class="bfseries">print a </b></tt><i class="it"># Note that this does not use Australian time</i><br /><tt class="ttfamily">Fri 1999 Dec 31 15:59:59 UTC</tt><br /><tt class="ttfamily">pyxplot&gt; <b class="bfseries">set timezone "Pacific/Chatham"</b></tt><br /><tt class="ttfamily">pyxplot&gt; <b class="bfseries">print a</b></tt><br /><tt class="ttfamily">Sat 2000 Jan 1 05:45:00 CHADT</tt><br /><tt class="ttfamily">pyxplot&gt; <b class="bfseries">set timezone "Antarctica/South_Pole"</b></tt><br /><tt class="ttfamily">pyxplot&gt; <b class="bfseries">print a</b></tt><br /><tt class="ttfamily">Sat 2000 Jan 1 05:00:00 NZDT</tt><br /><tt class="ttfamily">pyxplot&gt; <b class="bfseries">print a.toYear() </b></tt><i class="it"># at the south pole</i><br /><tt class="ttfamily">2000</tt><br /><tt class="ttfamily">pyxplot&gt; <b class="bfseries">print a.toYear("Europe/London")</b></tt><br /><tt class="ttfamily">1999</tt>   </p><p>Once created, it is possible to add numbers with physical units of time to dates, as in the following example: </p><p> <tt class="ttfamily">pyxplot&gt; <b class="bfseries">myDate = time.fromCalendar(2012,8,1,0,0,0)</b></tt><br /><tt class="ttfamily">pyxplot&gt; <b class="bfseries">print myDate + unit(7*day)</b></tt><br /><tt class="ttfamily">Wed 2012 Aug 8 00:00:00 UTC</tt><br /><tt class="ttfamily">pyxplot&gt; <b class="bfseries">print myDate - unit(2000*day)</b></tt><br /><tt class="ttfamily">Fri 2007 Feb 9 00:00:00 UTC</tt>   </p><p>In addition, if one date is subtracted from another date, the time interval between the two dates is returned as a number with physical dimensions of time: </p><p> <tt class="ttfamily">pyxplot&gt; <b class="bfseries">x = time.fromCalendar(-752,4,21,12,0,0)</b></tt><br /><tt class="ttfamily">pyxplot&gt; <b class="bfseries">y = time.fromCalendar( 476,9, 4,12,0,0)</b></tt><br /><tt class="ttfamily">pyxplot&gt; <b class="bfseries">print y-x</b></tt><br /><tt class="ttfamily">3.8764483e+10 s</tt><br /><tt class="ttfamily">pyxplot&gt; <b class="bfseries">print time.interval(y,x)</b></tt><br /><tt class="ttfamily">3.8764483e+10 s</tt><br /><tt class="ttfamily">pyxplot&gt; <b class="bfseries">print (y-x)/unit(year)</b></tt><br /><tt class="ttfamily">1228.3986</tt>   </p><p>Standard string representations of calendar dates can be produced with the <tt class="tt">print</tt> command. It is also possible to use the string substitution operator, as in <tt class="tt">"%s"%(date)</tt>, or the <tt class="tt">str</tt> method of <tt class="tt">date</tt> objects, as in <tt class="tt">date.str()</tt>. In addition, the <tt class="tt">time.string</tt> function can be used to choose a custom display format for the date; for more information, see Section <a href="sec-time_series.html">4.11</a>. </p><p>Several functions are provided for converting <tt class="tt">date</tt> objects back into various numerical forms of timekeeping and components of calendar dates: </p><p>   <big class="large"><b class="bf">toDayOfMonth()</b></big> <br />The toDayOfMonth() method returns the day of the month of a date object in the current calendar. <a name="a0000000627" id="a0000000627"></a>  </p><p>    <big class="large"><b class="bf">toDayWeekName()</b></big> <br />The toDayWeekName() method returns the name of the day of the week of a date object. <a name="a0000000628" id="a0000000628"></a>  </p><p>    <big class="large"><b class="bf">toDayWeekNum()</b></big> <br />The toDayWeekNum() method returns the day of the week (1–7) of a date object. <a name="a0000000629" id="a0000000629"></a>  </p><p>    <big class="large"><b class="bf">toHour()</b></big> <br />The toHour() method returns the integer hour component (0–23) of a date object. <a name="a0000000630" id="a0000000630"></a>  </p><p>    <big class="large"><b class="bf">toJD()</b></big> <br />The toJD() method converts a date object to a numerical Julian date. <a name="a0000000631" id="a0000000631"></a>  </p><p>    <big class="large"><b class="bf">toMinute()</b></big> <br />The toMinute() method returns the integer minute component (0–59) of a date object. <a name="a0000000632" id="a0000000632"></a>  </p><p>    <big class="large"><b class="bf">toMJD()</b></big> <br />The toMJD() method converts a date object to a modified Julian date. <a name="a0000000633" id="a0000000633"></a>  </p><p>    <big class="large"><b class="bf">toMonthName()</b></big> <br />The toMonthName() method returns the name of the month in which a date object falls. <a name="a0000000634" id="a0000000634"></a>  </p><p>    <big class="large"><b class="bf">toMonthNum()</b></big> <br />The toMonthNum() method returns the number (1–12) of the month in which a date object falls. <a name="a0000000635" id="a0000000635"></a>  </p><p>    <big class="large"><b class="bf">toSecond()</b></big> <br />The toSecond() method returns the seconds component (0–60) of a date object, including the non-integer component. <a name="a0000000636" id="a0000000636"></a>  </p><p>    <big class="large"><b class="bf">toUnix()</b></big> <br />The toUnix() method converts a date object to a Unix time. <a name="a0000000637" id="a0000000637"></a>  </p><p>    <big class="large"><b class="bf">toYear()</b></big> <br />The toYear() method returns the year in which a date object falls in the current calendar. <a name="a0000000638" id="a0000000638"></a>  </p><p>For example: </p><p> <tt class="ttfamily">pyxplot&gt; <b class="bfseries">a = time.fromCalendar(2000,1,1,0,0,0)</b></tt><br /><tt class="ttfamily">pyxplot&gt; <b class="bfseries">time.string(a)</b></tt><br /><tt class="ttfamily">Sat 2000 Jan 1 00:00:00 UTC</tt><br /><tt class="ttfamily">pyxplot&gt; <b class="bfseries">time.string(a,"%d %B %Y")</b></tt><br /><tt class="ttfamily">1 January 2000</tt><br /><tt class="ttfamily">pyxplot&gt; <b class="bfseries">set calendar muslim</b></tt><br /><tt class="ttfamily">pyxplot&gt; <b class="bfseries">time.string(a,"%d %B %Y")</b></tt><br /><tt class="ttfamily">21 Dhu l-Qa’da 1389</tt>   </p><p>More information on the manipulation of <tt class="tt">date</tt> objects can be found in Section <a href="sec-time_series.html">4.11</a>. </p></div>





<div class="navigation">
<table cellspacing="2" cellpadding="0" width="100%">
<tr>
<td><a href="sect0051.html" title="Color representations of the electromagnetic spectrum"><img alt="Previous: Color representations of the electromagnetic spectrum" border="0" src="icons/previous.gif" width="32" height="32" /></a></td>

<td><a href="chap-progDataTypes.html" title="Programming: Pyxplot’s data types"><img alt="Up: Programming: Pyxplot’s data types" border="0" src="icons/up.gif" width="32" height="32" /></a></td>

<td><a href="sect0053.html" title="Modules and classes"><img alt="Next: Modules and classes" border="0" src="icons/next.gif" width="32" height="32" /></a></td>

<td class="navtitle" align="center">PyXPlot Users' Guide</td>
<td><a href="index.html" title="Table of Contents"><img border="0" alt="" src="icons/contents.gif" width="32" height="32" /></a></td>

<td><a href="sect0288.html" title="Index"><img border="0" alt="" src="icons/index.gif" width="32" height="32" /></a></td>

<td><img border="0" alt="" src="icons/blank.gif" width="32" height="32" /></td>
</tr>
</table>
</div>

<script language="javascript" src="icons/imgadjust.js" type="text/javascript"></script>

</body>
</html>