Solved

convert DATE into DAY NUMBER (JULIAN/ORDINAL) in YYDDD FORMAT

Posted on 2013-05-10
4
763 Views
Last Modified: 2013-05-15
HI Experts,

I need a webpage with js in it so users can put in a normal date for it to be converted to JULIAN/ORDINAL in the format of YY/DDD

I have had a look online but cant find one in this format.

Please see attachment for example.

Any help would be appreciated,

Thanks
0
Comment
Question by:Richiep86
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 39155572
please provide of what you've
and what you want
0
 
LVL 22

Expert Comment

by:Kim Walker
ID: 39155987
I don't see an attachment.
0
 
LVL 7

Accepted Solution

by:
dimmergeek earned 500 total points
ID: 39162939
Without an attachment, it's difficult to know exactly what you're after, but....

<html>
<head>
<title>Date Conversion</title>
<script type="text/javascript" language="javascript">
    function GtoJ(formName) {
		var monthGreg = parseInt(formName[0].value);
		var dayGreg = parseInt(formName[1].value);
		var yearGreg = parseInt(formName[2].value);

		var dateStamp = new Date().setFullYear(yearGreg, monthGreg, dayGreg);
		var d = new Date();
		var first = new Date().setFullYear(2013,0,1);
		var theDay = Math.round(((dateStamp - first) / 1000 / 60 / 60 / 24) + .5, 0);
		var julian = (String(yearGreg).substring(4, 2) + "/" + theDay);
		formName[4].value = julian;
}
</script>
</head>
    <body>
        <form name="calForm" action="">
            <table align="center" border="5" cellpadding="5">
                <tr bgcolor="#FFFFFF">
                    <td bgcolor="#B6D4D2"><h2 align="center">Calendar Date Entry:
                        <select name="month">
                            <option value="">Select Month...</option>
                            <option value="0">January</option>
                            <option value="1">February</option>
                            <option value="2">March</option>
                            <option value="3">April</option>
                            <option value="4">May</option>
                            <option value="5">June</option>
                            <option value="6">July</option>
                            <option value="7">August</option>
                            <option value="8">September</option>
                            <option value="9">October</option>
                            <option value="10">November</option>
                            <option value="11">December</option>
                        </select>
                        &nbsp;&nbsp;
                        <input type="text" name="day" value="Day" size="3" maxlength="2" onfocus="this.value='';" />
                        &nbsp;&nbsp;
                        <input type="text" name="year" value="Year" size="5" maxlength="5" onfocus="this.value='';" /></h2><br /><br />
                        <center>
                            <input type="button" value="Click to convert Calendar Date to Julian..." onclick="GtoJ(calForm);" />
                        </center>
                        <h2 align="center">Julian Date: <input type="text" name="julianDay" /></h2>
                    </td>
                </tr>
            </table>
        </form>
    </body>
</html>

Open in new window

0
 

Author Closing Comment

by:Richiep86
ID: 39169108
Perfect, thanks
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Github api to fetch the number of collaborators in a git repo 1 32
Link Anchor Not working 9 51
Html using "Or" in condition 3 29
powershell automatic variable for results 21 28
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question