Date calculations
Joe Boyle
atla38@dsl.pipex.com
Wed, 2 Feb 2005 19:45:10 -0000
This is a multi-part message in MIME format.
------=_NextPart_000_003B_01C5095F.B5C5CF30
Content-Type: text/plain;
charset="US-ASCII"
Content-Transfer-Encoding: 7bit
I wonder if the cause of this behaviour be related to the fact that some
date types on VMS store dates as a number of nanoseconds from a base
date/time.
When 1 is subtracted from the date ( incorrectly ), the value held in the
result would differ from the original by only 1 nanosecond, which could be
enough to make quick think that the date represented is the previous day +
23 hours + 59 minutes and 59.999999999 seconds.
Regards, Joe.
_____
From: powerh-l-admin@lists.sowder.com
[mailto:powerh-l-admin@lists.sowder.com] On Behalf Of Kristina Carlton
Sent: 02 February 2005 16:12
To: 'powerh-l@lists.sowder.com'
Subject: Date calculations
Yesterday some emails were exchanged on calculating dates and that "DATE -
1" came up with an incorrect date of 02.00.2005. I calculate my date with
the following syntax:
DEFINE RUNDT DATE = DATE(DAYS(SYSDATE - 1))
This has worked every night except yesterday - February 1st. When I display
RUNDT it actually has Januray 31st, 2005 but when I run the extract I get
zero records. If I hard code January 31st, 2005 I do get records back. Am I
doing something wrong? I got my data, but I would like to understand why
this is happening.
We have OpenVMS V7.3-2 and I am using a Quiz extract.
Thanks,
Kristina Carlton
Senior Programmer/Analyst
The JI Companies
Kristina.Carlton@JICompanies.com
------=_NextPart_000_003B_01C5095F.B5C5CF30
Content-Type: text/html;
charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable
<html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns=3D"http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:"Century Gothic";
panose-1:2 11 5 2 2 2 2 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:9.0pt;
font-family:"Century Gothic";
color:black;}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline;}
p.MsoAutoSig, li.MsoAutoSig, div.MsoAutoSig
{margin:0cm;
margin-bottom:.0001pt;
font-size:9.0pt;
font-family:"Century Gothic";
color:black;}
p
{mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman";}
span.EmailStyle16
{mso-style-type:personal;
font-family:"Century Gothic";
color:navy;
font-weight:normal;
font-style:normal;}
span.EmailStyle19
{mso-style-type:personal-reply;
font-family:Arial;
color:navy;}
@page Section1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.Section1
{page:Section1;}
-->
</style>
</head>
<body lang=3DEN-US link=3Dblue vlink=3Dpurple>
<div class=3DSection1>
<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>I wonder if the cause of this =
behaviour be
related to the fact that some date types on VMS store dates as a number =
of
nanoseconds from a base date/time.<o:p></o:p></span></font></p>
<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>When 1 is subtracted from the date =
(
incorrectly ), the value held in the result would differ from the =
original by
only 1 nanosecond, which could be enough to make quick think that the =
date
represented is the previous day + 23 hours + 59 minutes and 59.999999999
seconds.<o:p></o:p></span></font></p>
<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<div>
<p><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:10.0pt;font-family:
Arial;color:navy'>Regards, Joe.</span></font><font color=3Dnavy><span
style=3D'color:navy'> <o:p></o:p></span></font></p>
</div>
<div>
<div class=3DMsoNormal align=3Dcenter style=3D'text-align:center'><font =
size=3D3
color=3Dblack face=3D"Times New Roman"><span =
style=3D'font-size:12.0pt;font-family:
"Times New Roman";color:windowtext'>
<hr size=3D3 width=3D"100%" align=3Dcenter tabindex=3D-1>
</span></font></div>
<p class=3DMsoNormal><b><font size=3D2 color=3Dblack face=3DTahoma><span
style=3D'font-size:10.0pt;font-family:Tahoma;color:windowtext;font-weight=
:bold'>From:</span></font></b><font
size=3D2 color=3Dblack face=3DTahoma><span =
style=3D'font-size:10.0pt;font-family:Tahoma;
color:windowtext'> powerh-l-admin@lists.sowder.com
[mailto:powerh-l-admin@lists.sowder.com] <b><span =
style=3D'font-weight:bold'>On
Behalf Of </span></b>Kristina Carlton<br>
<b><span style=3D'font-weight:bold'>Sent:</span></b> 02 February 2005 =
16:12<br>
<b><span style=3D'font-weight:bold'>To:</span></b> =
'powerh-l@lists.sowder.com'<br>
<b><span style=3D'font-weight:bold'>Subject:</span></b> Date =
calculations</span></font><font
size=3D3 color=3Dblack face=3D"Times New Roman"><span =
style=3D'font-size:12.0pt;
font-family:"Times New =
Roman";color:windowtext'><o:p></o:p></span></font></p>
</div>
<p class=3DMsoNormal><font size=3D1 color=3Dblack face=3D"Century =
Gothic"><o:p> </o:p></font></p>
<p class=3DMsoNormal><span class=3DEmailStyle16><font size=3D1 =
color=3Dnavy
face=3D"Century Gothic"><span style=3D'font-size:9.0pt'>Yesterday some =
emails were
exchanged on calculating dates and that “DATE – 1” =
came up
with an incorrect date of 02.00.2005. I calculate my date with the =
following
syntax:<o:p></o:p></span></font></span></p>
<p class=3DMsoNormal><span class=3DEmailStyle16><font size=3D1 =
color=3Dnavy
face=3D"Century Gothic"><span =
style=3D'font-size:7.5pt'><o:p> </o:p></span></font></span></p>
<p class=3DMsoNormal><span class=3DEmailStyle16><font size=3D1 =
color=3Dnavy
face=3D"Century Gothic"><span style=3D'font-size:9.0pt'>DEFINE RUNDT
DATE =3D DATE(DAYS(SYSDATE - =
1))<o:p></o:p></span></font></span></p>
<p class=3DMsoNormal><span class=3DEmailStyle16><font size=3D1 =
color=3Dnavy
face=3D"Century Gothic"><span =
style=3D'font-size:7.5pt'><o:p> </o:p></span></font></span></p>
<p class=3DMsoNormal><span class=3DEmailStyle16><font size=3D1 =
color=3Dnavy
face=3D"Century Gothic"><span style=3D'font-size:9.0pt'>This has worked =
every night
except yesterday – February 1<sup>st</sup>. When I display RUNDT =
it
actually has Januray 31<sup>st</sup>, 2005 but when I run the extract I =
get
zero records. If I hard code January 31<sup>st</sup>, 2005 I do get =
records
back. Am I doing something wrong? I got my data, but I would like to =
understand
why this is happening.<o:p></o:p></span></font></span></p>
<p class=3DMsoNormal><span class=3DEmailStyle16><font size=3D1 =
color=3Dnavy
face=3D"Century Gothic"><span =
style=3D'font-size:7.5pt'><o:p> </o:p></span></font></span></p>
<p class=3DMsoNormal><span class=3DEmailStyle16><font size=3D1 =
color=3Dnavy
face=3D"Century Gothic"><span style=3D'font-size:9.0pt'>We have OpenVMS =
V7.3-2 and
I am using a Quiz extract.<o:p></o:p></span></font></span></p>
<p class=3DMsoNormal><span class=3DEmailStyle16><font size=3D1 =
color=3Dnavy
face=3D"Century Gothic"><span =
style=3D'font-size:7.5pt'><o:p> </o:p></span></font></span></p>
<p class=3DMsoNormal><span class=3DEmailStyle16><font size=3D1 =
color=3Dnavy
face=3D"Century Gothic"><span =
style=3D'font-size:9.0pt'>Thanks,<o:p></o:p></span></font></span></p>
<p class=3DMsoNormal><span
class=3DEmailStyle16><font color=3Dnavy face=3D"Century Gothic">Kristina =
Carlton<o:p></o:p></font></span></p>
<p class=3DMsoNormal><span class=3DEmailStyle16><font size=3D1 =
color=3Dnavy
face=3D"Century Gothic"><span style=3D'font-size:9.0pt'>Senior =
Programmer/Analyst<o:p></o:p></span></font></span></p>
<p class=3DMsoNormal><span class=3DEmailStyle16><font size=3D1 =
color=3Dnavy
face=3D"Century Gothic"><span style=3D'font-size:9.0pt'>The JI =
Companies<o:p></o:p></span></font></span></p>
<p class=3DMsoNormal><span class=3DEmailStyle16><font size=3D1 =
color=3Dnavy
face=3D"Century Gothic"><span =
style=3D'font-size:9.0pt'>Kristina.Carlton@JICompanies.com<o:p></o:p></sp=
an></font></span></p>
<p class=3DMsoNormal><o:p> </o:p></p>
</div>
</body>
</html>
------=_NextPart_000_003B_01C5095F.B5C5CF30--