Asp.net programming we consider all important topic for knowledge about controls,web Services, JSON, Ajax, database, and interview related Question. In this Asp.net and sql server tutorial blog we give many examples of jquery as like How Play YouTube Video in Your Asp.net Website by URL, How to Play YouTube Videos in Asp.net by using Jquery , Jquery Change div background on mouseover in asp.net , JQuery UI Datepicker (Calendar) etc.

Sunday, September 7, 2014

Get current datetime in jquery and javaScript

Get Current Date and Time using JQuery:


In this post we descript how to get current date and time in asp.net web page by jquery.  Here we see a Example for showing date and time of server on web page. Many times we search on google for getting the Ans of this type Question we type in to search box datetime jquery plugin or datetime jquery or datetime in jquery calendar or jquery datetime format etc.

jquery datetime now:

Use fallowing Jquery for google.
:http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js

JQuery Related other Post:

Jquery for date time to string:

        $(document).ready(function () {
            var param1 = new Date();
            var param2 = param1.getDate() + '/' + (param1.getMonth() + 1) + '/' + param1.getFullYear() + ' ' + param1.getHours() + ':' + param1.getMinutes() + ':' + param1.getSeconds();
            $('#lbltxtdate').text(param2)
        }) 

How to Get current datetime in jquery:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="getcrrrentdate.aspx.cs" Inherits="getcrrrentdate" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Current Datetime by JQuery</title>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js">
    </script>
    <script type="text/javascript" language="javascript">
        $(document).ready(function () {
            var param1 = new Date();
            var param2 = param1.getDate() + '/' + (param1.getMonth() + 1) + '/' + param1.getFullYear() + ' ' + param1.getHours() + ':' + param1.getMinutes() + ':' + param1.getSeconds();
            $('#lbltxtdate').text(param2)
        })
    </script>
    <style type="text/css">
        .style1
        {
            color: #990000;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div align="center">
        <h1>
            <span class="style1">Get Current Datetime using JQuery</span>
        </h1>
    </div>
    <div align="center">
        <h1>
            <br />
            <label id="lbltxtdate" style="color: #CC66FF" />
        </h1>
    </div>
    </form>
</body>
</html>


jquery datetime format Example:


Get current datetime in jquery and javaScript

Other Asp.net Checkbox related post or example:





No comments:

Post a Comment