A simple Javascript function that prints the information about system date
Code:
<script type="text/javascript">
function GetDateInfo() {
cd = new Date();
document.write("cd = new Date();");
document.write("<br />");
document.write("cd.getDate(): " + cd.getDate());
document.write("<br />");
document.write("cd.getDay(): " + cd.getDay());
document.write("<br />");
document.write("cd.getFullYear(): " + cd.getFullYear());
document.write("<br />");
document.write("cd.getHours(): " + cd.getHours());
document.write("<br />");
document.write("cd.getMinutes(): " + cd.getMinutes());
document.write("<br />");
document.write("cd.getSeconds(): " + cd.getSeconds());
document.write("<br />");
document.write("cd.getMilliseconds(): " + cd.getMilliseconds());
document.write("<br />");
document.write("cd.getTime(): " + cd.getTime());
document.write("<br />");
document.write("cd.getYear(): " + cd.getYear());
}
</script>
Result:
cd = new Date();
cd.getDate(): 1
cd.getDay(): 3
cd.getFullYear(): 2012
cd.getHours(): 16
cd.getMinutes(): 14
cd.getSeconds(): 11
cd.getMilliseconds(): 817
cd.getTime(): 1328109251817
cd.getYear(): 112
If our work has been of help, you can help us with a small donation...
Our programmers will thank you!
Related code snippets posted in
Javascript:
The best
Javascript
recommended books:
All information contained in this web site are the property of MdmSoft.
The information is provided "as is", MdmSoft will not be liable for any misuse of the code contained in these pages,
nor can it be for inaccuracies, grammatical errors or other factors that may have caused damage or lost earnings.
MdmSoft is not responsible for the content of comments posted by users.
The examples in this area have the educational and demonstration purposes only,
and may be copied only for your reference, but cannot be used for commercial purposes,
or for any other purpose, without the express written consent of MdmSoft.
MdmSoft also reserves the right to change, without notice, to your liking this web site,
the pages and its sections, and may suspend temporarily or definitely the various services included on this site.
While using this site, you agree to have read and accepted our Terms of Service and Privacy Policy.