This Blog is for show current date and time with out post back.

Code for .aspx page in body section

  1. <label id="Date"></label> | <label id="hours"></label><span style="text-decoration:blink">:</span><label id="min"></label><label id="point1" style="text-decoration:blink">:</label><label id="sec"></label> <label id="ampm"></label>[Login Time:<asp:Label ID="lbl_time" runat="server" Text=""></asp:Label>
Java script fuction for show date and time
  1. $(document).ready(function () {
  2. // Create two variable with the names of the months and days in an array
  3. var monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
  4. var dayNames = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
  5. // Create a newDate() object
  6. var newDate = new Date();
  7. // Extract the current date from Date object
  8. newDate.setDate(newDate.getDate());
  9. // Output the day, date, month and year
  10. $('#Date').html(dayNames[newDate.getDay()] + " " + newDate.getDate() + ' ' + monthNames[newDate.getMonth()] + ' ' + newDate.getFullYear());
  11. setInterval(function () {
  12. // Create a newDate() object and extract the seconds of the current time on the visitor's
  13. var seconds = new Date().getSeconds();
  14. // Add a leading zero to seconds value
  15. $("#sec").html((seconds < 10 ? "0" : "") + seconds);
  16. }, 1000);
  17. setInterval(function () {
  18. // Create a newDate() object and extract the minutes of the current time on the visitor's
  19. var minutes = new Date().getMinutes();
  20. // Add a leading zero to the minutes value
  21. $("#min").html((minutes < 10 ? "0" : "") + minutes);
  22. }, 1000);
  23. setInterval(function () {
  24. // Create a newDate() object and extract the hours of the current time on the visitor's
  25. var hours = new Date().getHours() == 0 ? "12" : new Date().getHours() > 12 ? new Date().getHours() - 12 : new Date().getHours();
  26. // Add a leading zero to the hours value
  27. $("#hours").html((hours < 10 ? "0" : "") + hours);
  28. }, 1000);
  29. setInterval(function () {
  30. var ampm = new Date().getHours() < 12 ? "AM" : "PM";
  31. $("#ampm").html(ampm);
  32. }, 1000);
  33. });
Save above java script name as ClockPlugin.js

Than call it on head section...
  1. <script src="ClockPlugin.js" type="text/javascript"></script>
Now run this u can see date and time like a timer.

Enjoy.