|
 |
asp_databases thread: How to display date in format MM/DD/YYYY with Javascript
Message #1 by Gui You <guiyou01@y...> on Thu, 13 Feb 2003 21:18:47 -0800 (PST)
|
|
Hi all,
I am writing the ASP, but I need to use Javascript for comparing date displaying. I want to know how to display date in format
MM/DD/YYYY ( I can use this format getting the date in ASP). Thank you for your help in advance.
YoYo
---------------------------------
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
Message #2 by "Anand" <info@s...> on Fri, 14 Feb 2003 15:29:29 +0530
|
|
HI,
Hope this will help you!!!
<script language="JavaScript">
function makeArray(n){
this.length = n;
for (i=1;i<=n;i++){
this[i]=0;
}
return this;
}
function makeArrayDay(j){
this.length = j;
for (k=1;k<=j;k++){
this[k]=0;
}
return this;
}
function displayDate() {
var this_month = new makeArray(12);
this_month[0] = "January";
this_month[1] = "February";
this_month[2] = "March";
this_month[3] = "April";
this_month[4] = "May";
this_month[5] = "June";
this_month[6] = "July";
this_month[7] = "August";
this_month[8] = "September";
this_month[9] = "October";
this_month[10] = "November";
this_month[11] = "December";
var this_getDay = new makeArrayDay(7);
this_getDay[0] = "Sunday";
this_getDay[1] = "Monday";
this_getDay[2] = "Tuesday";
this_getDay[3] = "Wednesday";
this_getDay[4] = "Thusday";
this_getDay[5] = "Friday";
this_getDay[6] = "Saturday";
var today = new Date();
var day = today.getDate();
var month = today.getMonth();
var year = today.getYear();
var getDay = today.getDay();
if (year < 100){
year += 1900;
}
return(this_getDay[getDay]+", "+this_month[month]+" "+day+", "+year);
}
</script>
// to display use this code
<script language="JavaScript">
<!--
document.write (displayDate());
//-->
</script>
Thanks and regards
Anand Bisht
eBusiness Application Developer - Consultant
668, 6th Main, 7th Cross, HAL 2nd Stage,
Indiranagar, Bangalore - 560008 (India)
E-mail: info@s...
Phone Res: +xx xx xxxxxxx
Phone Off: +xx xx xxxxxxx / xxxxxxx x 24
----- Original Message -----
From: "Gui You" <guiyou01@y...>
To: "ASP Databases" <asp_databases@p...>
Sent: Friday, February 14, 2003 10:48 AM
Subject: [asp_databases] How to display date in format MM/DD/YYYY with
Javascript
>
> Hi all,
>
> I am writing the ASP, but I need to use Javascript for comparing date
displaying. I want to know how to display date in format MM/DD/YYYY ( I can
use this format getting the date in ASP). Thank you for your help in
advance.
>
> YoYo
>
>
>
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Shopping - Send Flowers for Valentine's Day
>
Message #3 by "Jason Wilding" <Jason.Wilding@w...> on Fri, 14 Feb 2003 11:16:03 +0000
|
|
You could also set the date with VB script on an .asp page llike
this...
<% LANGUAGE=VBScript %>
<% strcurrentdate = day(date) & "/" & month(date) & "/" & year(date)
%>
<% Response.Write strcurrentdate %>
|
|
 |