# How to convert a date to a julian date formatted CYYDDD (SCI87036)

## Question

How to convert a date to a julian date formatted CYYDDD (SCI87036)

## Cause

Using the following sample Extended Rule:

string [3] sCentury,sYear, sDay,tmpDay;
String [7] tempstrdate, converteddate;

sCentury = "";
sYear = "";
sDay = "";
tempstrdate = "";
tmpDay = "00";

strdate(#OrderDate,"%Y%j",tempstrdate);

sCentury = Left (tempstrdate,2);
sYear = mid(tempstrdate,2,2);
sDay = mid(tempstrdate,4,3);

if sCentury = "20" then sCentury = "1";
if sCentury = "19" then sCentury = "0";

if len(sDay) = 1 then tmpDay = tmpDay + sDay;
else if len(sDay) = 2 then tmpDay = Left(tmpDay,1) + sDay;
else tmpDay = sDay;

converteddate = sCentury + sYear + tmpDay;
\$Dummy.#Dummy = ATOI(converteddate);

PRI9589

## Product Synonym

[<p><b>]Fact[</b><p>];[<p>]Gentran:Server for Windows, All Releases [<br />] Gentran Integration Suite,
all Releases [<br />] Gentran:Server for UNIX, Release 6.0 [<br />] Gentran:Server
for UNIX, Release 6.1 [<br />] Gentran:Director for Windows, All Releases [<br />]
SCI87036 [<br />] Map Editor [<br />] Extended Rules[</p>];[<p><b>]Goal[</b><p>];[<p>]How to convert a date to a Julian date formatted CYYDDD[</p>]

Modified date:
14 November 2019

swg21544762