Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Show date function

Status
Not open for further replies.

JohnnyHotrocks

Technical User
Oct 29, 2001
1
GB
I need to be able to show the days date like Monday 29 October 2001 and also show the next days date. Hope someone can help.

Cheers
 
I dont know a pure flash command for this, but given that you can use javascript in flash, you could use the getDate function...
This comes in numerical form, so you need to declare each case.
I have this on my website, andthis is how i coded it...:

<script language=&quot;JavaScript&quot;>
var day=&quot;&quot;;
var month=&quot;&quot;;
var myweekday=&quot;&quot;;
var year=&quot;&quot;;
mydate = new Date();
myday = mydate.getDay();
mymonth = mydate.getMonth();
myweekday= mydate.getDate();
weekday= myweekday;
myyear= mydate.getYear();
year = myyear
if(myday == 0)
day = &quot; sunday, &quot;
else if(myday == 1)
day = &quot; monday, &quot;
else if(myday == 2)
day = &quot; tuesday, &quot;
else if(myday == 3)
day = &quot; wednesday, &quot;
else if(myday == 4)
day = &quot; thursday, &quot;
else if(myday == 5)
day = &quot; friday, &quot;
else if(myday == 6)
day = &quot; saturday, &quot;
if(mymonth == 0) {
month = &quot;january &quot;}
else if(mymonth ==1)
month = &quot;february &quot;
else if(mymonth ==2)
month = &quot;march &quot;
else if(mymonth ==3)
month = &quot;april &quot;
else if(mymonth ==4)
month = &quot;may &quot;
else if(mymonth ==5)
month = &quot;june &quot;
else if(mymonth ==6)
month = &quot;july &quot;
else if(mymonth ==7)
month = &quot;august &quot;
else if(mymonth ==8)
month = &quot;september &quot;
else if(mymonth ==9)
month = &quot;october &quot;
else if(mymonth ==10)
month = &quot;november &quot;
else if(mymonth ==11)
month = &quot;december &quot;

if ((navigator.appName == &quot;Microsoft Internet Explorer&quot;) && (year < 2000))
year=&quot;19&quot; + year;
if (navigator.appName == &quot;Netscape&quot;)
year=1900 + year;
document.write(&quot;<font face=andale mono size=1 color=999999>&quot; + day + month);
document.write(myweekday + &quot;, &quot; + year + &quot;</font>&quot;);
</script>

If you wanted to show the next day you could simply use the &quot;+&quot; operator..
I really think javascript holds the key for you here :)
Hope this helps
John
 
or with less typing..modify the array to determine tomorrows date..

Code:
Dayarray = new Array(&quot;Sunday&quot;, &quot;Monday&quot;, &quot;Tuesday&quot;, &quot;Wednesday&quot;,&quot;Thursday&quot;,
&quot;Friday&quot;,&quot;Saturday&quot;);
Montharray = new Array(&quot;January&quot;,&quot;February&quot;,&quot;March&quot;,&quot;April&quot;,&quot;May&quot;,&quot;June&quot;,&quot;July&quot;,
&quot;August&quot;,&quot;September&quot;,&quot;October&quot;,&quot;November&quot;,&quot;December&quot;);
Hourarray = new Array(&quot;12&quot;,&quot;1&quot;,&quot;2&quot;,&quot;3&quot;,&quot;4&quot;,&quot;5&quot;,&quot;6&quot;,&quot;7&quot;,&quot;8&quot;,&quot;9&quot;,&quot;10&quot;,&quot;11&quot;,&quot;12&quot;,
&quot;1&quot;,&quot;2&quot;,&quot;3&quot;,&quot;4&quot;,&quot;5&quot;,&quot;6&quot;,&quot;7&quot;,&quot;8&quot;,&quot;9&quot;,&quot;10&quot;,&quot;11&quot;);
a = new Date();
b = a.getFullYear();
c = a.getMonth();
d = a.getDate();
e = a.getDay();
f = a.getHours();
g = a.getMinutes();
if (g<10) {
	g = &quot;0&quot;+g;
}
h = a.getSeconds();
if (h<10) {
	h = &quot;0&quot;+h;
}
monthName = Montharray[c];
dayName = Dayarray[e];
hourValue = Hourarray[f];
show = dayName+&quot; &quot;+monthName+&quot; &quot;+d+&quot;,&quot;+&quot; &quot;+b+&quot; &quot;+hourValue+&quot;:&quot;+g+&quot; &quot;+h;

thank tulsa for that one...
logo.gif


carlsatterwhite@orlandomediasolutions.com
 
daDate = &quot;&quot;;
daMonth = [&quot;January&quot;, &quot;February&quot;, &quot;March&quot;, &quot;April&quot;, &quot;May&quot;, &quot;June&quot;, &quot;July&quot;, &quot;August&quot;, &quot;September&quot;, &quot;October&quot;, &quot;November&quot;, &quot;December&quot;];
daDay = [&quot;Sunday&quot;, &quot;Monday&quot;, &quot;Tuesday&quot;, &quot;Wednesday&quot;, &quot;Thursday&quot;, &quot;Friday&quot;, &quot;Saturday&quot;];
date = new Date();
theday = thedate add daDay[date.getDay()];
themonth = daMonth[date.getMonth()];
thedate = date.getDate();
thedate = thedate add &quot; &quot;;
theyear = date.getFullYear();


The above code shows todays date but I do not understand how your array would fit into this to display the corresponding 12 days dates.
 
it doesn't, you would have to modify the array to determine the next days date and time..which by the way, why are you doing that?..benefits would be?.
logo.gif


carlsatterwhite@orlandomediasolutions.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top