Date in Textbox

Does anyone know how to populate a Textbox with the current date?

I have a Input textbox that i will make locked that i just want to have it populated with the current date everytime my form is opened.

Comments

  • : Does anyone know how to populate a Textbox with the current date?
    :
    : I have a Input textbox that i will make locked that i just want to have it populated with the current date everytime my form is opened.
    :
    :
    Hi!

    Which date you want to populate? Server or Client?


    1. To populate Server's date, it's very simple.
    [code]
    ">
    [/code]


    2. To populate user's local system date
    [code]

    function populateDate()
    {
    var d =new Date();
    txtCurDate.value = d.getMonth() +"/"+d.getDay()+ "/"+d.getFullYear();
    }

    .
    .
    .

    .
    .

    ..
    [/code]

    :)heers,
    Vanith

  • running time:


    var timerID = null;
    var timerRunning = false;
    function stopclock (){
    if(timerRunning)
    clearTimeout(timerID);
    timerRunning = false;}
    function startclock () {
    stopclock();
    showtime();}
    function showtime () {
    var now = new Date();
    var hours = now.getHours();
    var minutes = now.getMinutes();
    var seconds = now.getSeconds()
    var timeValue = "" +((hours >= 12) ? "AM " : "PM " )
    timeValue += ((hours >12) ? hours -12 :hours)
    timeValue += ((minutes < 10) ? ":0" : ":") + minutes
    timeValue += ((seconds < 10) ? ":0" : ":") + seconds
    document.clock.thetime.value = timeValue;
    timerID = setTimeout("showtime()",1000);
    timerRunning = true;}






Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories