View Full Version : Javascript date in form programing help

06-10-2004, 06:59 PM
I’ve started a script that I can’t seem to finish on my own so maybe somebody out there can help me or recommend an alternative

I have a form that when the user enters a serial number the form will display
The year manufactured
The city and state where manufactured
And the the month and day

Serial number: 70108276
The 7 and 8 represent the year “78”
010 represent the julian date which would be “January 10”
276 represent the manufactures code

I was able to extract the 7 and 8 and concatenate the year 78
And also 276 to produce the manufacturer.
How can I convert 010 to display as January 10 or concatenate with the 7 and 8 to produce January 10, 1978
Below is an example of what I have thus far

<script language="javascript">
function findChar()
var serialOne = document.form1.textbox2.value.charAt(0);
var serialTwo = document.form1.textbox2.value.charAt(4);
var dddNum = document.form1.textbox2.value.substring(1,4);
var pppNum = document.form1.textbox2.value.substring(5,8);
document.form1.result.value=(serialOne + serialTwo)

//Manuafactured by
if ((pppNum >= 1) && (pppNum <= 499)){ pppNum = "Kalamazoo, Michigan";}
else if ((pppNum >= 500) && (pppNum <= 999)){ pppNum = "Nashville, Tennessee";}





<Table border="1" width="600"><tr><td colspan="3">
<form name="form1">
Enter the serial number&nbsp;<input type="text" name="textbox2" size="10" value="">
<input type="button" value=" Lookup " onclick="findChar()">&nbsp;<INPUT TYPE="reset" VALUE="Reset">

<td align="center">Production Year</td><td align="center">Production Date</td><td align="center">Manufactured at</td></tr>
<td align="center"><input type="text" value="" name="result" size="15"></td>
<td align="center"><input type="text" value="" name="result1" size="15"></td>
<td align="center"><input type="text" value="" name="result2" size="40"></td>

Thanks in advance!

06-11-2004, 04:19 PM
Take a look at the following snippit and see if it helps:

var dddNum = prompt('J Date',0);
MonthDays=new Array(0,31,59,90,120,151,181,212,243,273,304,334);
MonthNames=new Array('January','February','March',
for (i=0; i<=11; i++) {
if (dddWork > MonthDays[i]) {
alert(MonthNames[MonthNum]+' '+dddWork2);