Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 19-11-2009
Member
 
Join Date: Apr 2009
Posts: 79
Date Script at HTML

I a looking for code in html to display date and time. The code must display current date and time. Is that possible to display previous date and time with the same code, if yes then what are syntax need to declare for current and previous date format.
Reply With Quote
  #2  
Old 19-11-2009
Member
 
Join Date: May 2008
Posts: 2,293
Re: Date Script at HTML

HTML codes for date :
Code:
<script language="JavaScript">
<!--
date=Date()
document.write(date)
//-->
</script>
Reply With Quote
  #3  
Old 19-11-2009
Member
 
Join Date: Jan 2009
Posts: 199
Re: Date Script at HTML

Code:
<Script type="text/javaScript"> 

// current date. 
var nw = new Date(); 


var dys = new Array('Sund','Mon','Tues','Wed','Thur','Fri','Sat'); 

// Array list of months. 
var months = new Array('Jan','Feb','Mar','Ap','Ma','Jun','Jul','Aug','Sep','Oct','Nov','Dec'); 

var date = ((now.getDate()<10) ? "0" : "")+ now.getDate(); 

function fourts(number)   { 
   return (number < 1000) ? number + 1900 : number; 
                        } 
tod =  days[now.getDay()] + ", " + 
         months[now.getMonth()] + " " + 
         date + ", " + 
         (fourdigits(now.getYear())) ; 

document.write(tod); 

//  End --> 
</script>
Reply With Quote
  #4  
Old 19-11-2009
Member
 
Join Date: Dec 2008
Posts: 177
Re: Date Script at HTML

Try the following code to display date in html
Code:
<script type="text/javascript">
var da=new Date();
var weda=new Array
("Sun","Mon","Tue","Wed","Thu","Fri", "Sat");
var month=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
document.write(weekday[da.getDay()] + " ");
document.write(da.getDate() + ". ");
document.write(monthname[da.getMonth()] + " ");
document.write(da.getFullYear());</script>
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Date Script at HTML"
Thread Thread Starter Forum Replies Last Post
Where can I get free HTML Wallpaper Script Brexton Software Development 4 17-01-2011 07:55 AM
Date field in HTML form Messenger Software Development 6 29-07-2010 10:30 AM
PHP Decoder for HTML Script Mind It Software Development 3 29-09-2009 02:36 PM
Date, days in HTML Jacob Software Development 4 09-02-2009 09:17 PM
Script insert date in the name of my file Viensterrr Software Development 4 31-10-2008 07:18 PM


All times are GMT +5.5. The time now is 07:58 PM.