IT Community - Software Programming, Web Development and Technical Support

How can I show the documents last modified date in the format: month, date, year, tim

This is a discussion on How can I show the documents last modified date in the format: month, date, year, tim within the HTML, CSS and Javascript Coding Techniques forums, part of the Web Development category; Hi all... can anyone tell me How can I show the documents last modified date in the format: month, date, ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > HTML, CSS and Javascript Coding Techniques

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 12-24-2007, 06:12 AM
Pvinothkumar Pvinothkumar is offline
D-Web Analyst
 
Join Date: Sep 2007
Posts: 237
Pvinothkumar is on a distinguished road
Default How can I show the documents last modified date in the format: month, date, year, tim

Hi all...


can anyone tell me How can I show the documents last modified date in the format: month, date, year, time(GMT)?

Thanks...
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 12-24-2007, 06:14 AM
itbarota itbarota is offline
D-Web Architect
 
Join Date: Jun 2007
Posts: 547
itbarota is on a distinguished road
Default Re: How can I show the documents last modified date in the format: month, date, year,

Hi all...


<SCRIPT LANGUAGE = 'JavaScript'>
function makeArray() { for (i = 0; i<makeArray.arguments.length; i++) this[i + 1] = makeArray.arguments[i]; }


function getCorrectedYear(year) {
year = year - 0;
if (year < 70) return (2000 + year);
if (year < 1900) return (1900 + year);
return year;
}

Thanks...

function y2k(number) { return (number < 1000) ? number + 1900 : number; }

var months = new makeArray('January','February','March','April','Ma y','June','July','August','September','October','N ovember','December');

var date = new Date(document.lastModified);
var dateY2K = new Date(getCorrectedYear(date.getYear()),date.getMont h(),date.getDate());
var dateGMT = dateY2K.toGMTString();
document.write(months[dateY2K.getMonth() + 1] + ', ' + dateY2K.getDate() + ', ' + y2k(dateY2K.getYear()) + ', ' + dateGMT.substring(dateGMT.indexOf(':')-2,dateGMT.indexOf(':')+6));
</SCRIPT>
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 12-25-2007, 08:55 PM
shaalini shaalini is offline
D-Web Analyst
 
Join Date: Apr 2007
Posts: 342
shaalini is on a distinguished road
Default Re: How can I show the documents last modified date in the format: month, date, year,

da = new Date(document.lastModified) // Create a Date Object set to the last modifed date
dy = da.getFullYear() // Get full year (as opposed to last two digits only)
dm = da.getMonth() + 1 // Get month and correct it (getMonth() returns 0 to 11)
dd = da.getDate() // Get date within month
if ( dy < 1970 ) dy = dy + 100; // We still have to fix the millennium bug
ys = new String(dy) // Convert year, month and date to strings
ms = new String(dm)
ds = new String(dd)
if ( ms.length == 1 ) ms = "0" + ms; // Add leading zeros to month and date if required
if ( ds.length == 1 ) ds = "0" + ds;
ys = ys + "-" + ms + "-" + ds // Combine year, month and date in ISO format
document.write ( "Last Updated " + ys ) // Display the result
__________________
Shaalini.S
Be the Best of Whatever you are...
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 12-28-2007, 05:58 AM
kingmaker kingmaker is offline
D-Web Genius
 
Join Date: Jun 2007
Posts: 882
kingmaker is on a distinguished road
Send a message via Yahoo to kingmaker
Smile Re: How can I show the documents last modified date in the format: month, date, year,

da = new Date(document.lastModified) // Create a Date Object set to the last modifed date
db = da.toGMTString() // Convert to a String in "predictable formt"
dc = db.split(" ") // Split the string on spaces
if ( eval( dc[3] ) < 1970 ) dc[3] = eval( dc[3] ) +100 // Correct any date purporting to be before 1970
db = dc[1] + " " + dc[2] + " " + dc[3] // Ignore day of week and combine date, month and year
document.write ( "Last Updated " + db )
__________________
The KINGMAKER
Makes Every Thing Possible

Stuffs (My Blog)
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date format yymmdd itbarota HTML, CSS and Javascript Coding Techniques 2 03-03-2008 09:07 PM
write to the document both the Last Modified and a review date, i.e. Last Modified itbarota HTML, CSS and Javascript Coding Techniques 1 02-18-2008 08:34 PM
display the date in the format weekday, dd, month, year, for example Friday, 11 Dec98 itbarota HTML, CSS and Javascript Coding Techniques 1 02-18-2008 08:31 PM
How do I format the Last-Modified date with javascript? Pvinothkumar HTML, CSS and Javascript Coding Techniques 1 10-12-2007 11:17 PM
How to convert a date to a globally accepted date format, in DOT NET 2005? Archer C# Programming 1 07-25-2007 03:21 AM


All times are GMT -7. The time now is 01:01 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0