View Full Version : how to trim the date
phani
09-18-2002, 08:01 AM
how to trim the date in the textfield that contains the date and time to date only
glenngv
09-18-2002, 08:36 AM
is the value of the date textbox a user input or dynamically generated? I mean why does it have time in it?
just a guess but it may be helpful anyway...
<html>
<head>
<title>test</title>
<script language="javascript">
function dateOnly(){
var now=new Date(document.lastModified)
d=now.getDate()
m=now.getMonth()+1
y=now.getFullYear()
document.f1.ta.value=m+"/"+d+"/"+y
}
function dateTime(){
document.f1.t.value=document.lastModified
}
</script>
</head>
<body onload="dateOnly();dateTime()">
<h4>
Date in month/day/year format
</h4>
<form name="f1">
<input type="text" name="t"value="">Date and Time<br>
<input type="text" name="ta" value="">Date Only
</form>
</body>
</html>
glenngv
09-18-2002, 09:57 AM
is this a typo?
<body onload="dateOnly(),dateTime()">
it should have been a semicolon
Thanks glenngv. It was a typo and I've edited the script.
One of the real benefits of this forum is that mediocre scripters like myself have experienced programmers like yourself and adios around to help out. Not to mention that your (and others) scripts provide great examples to learn from, even if it takes me a while to get the gist of some things.
:thumbsup:
phani
09-19-2002, 11:27 AM
THANK U FOR FOR ALL OF U FOR GUIDING ME
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.