Solved

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

Posted on 2013-05-10
4
744 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 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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Logon script fails 23 45
VBScript on Html 15 47
Add or delete table rows 10 54
Filling an MVC dropdown based on selections from a textbox (datepicker) .NET/Jquery/JS/MVC 9 26
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
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.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

829 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