Solved

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

Posted on 2013-05-10
4
693 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
4 Comments
 
LVL 82

Expert Comment

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

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now