Results 1 to 2 of 2

Thread: Time zone stamp

  1. #1
    ddscart is offline Member
    Join Date
    Aug 2009
    Location
    Georgia, USA
    Posts
    2
    Rep Power
    0

    Default Time zone stamp

    This is a function used in a “js” file for the chat box on my forum. The code between the rows of “+” simply format and add a timestamp to each post in the chat box. The time posted is each member’s local time; I wanted to have the time zone after the time. The time appears as it should, but I cannot get the time zone to show. I have tried the code in red, but all crash the chat box.

    You can see the chat box at my site; 3w.ddscart.org

    My question is; how do I make the time zone show.



    function postText()

    // ++++++++++++++++++++++++++++++++++
    {
    var timestamp;
    var A_P; // am or pm
    var H_r; // hour
    var M_i; // minute
    var T_z; // timezone


    time = new Date ();
    M_i = time.getMinutes();
    H_r = time.getHours();
    A_P = ""; // Had to clear to stop improper readings – why?
    // T_z = system.getTimeZone();
    // T_z = time.getTimeZone();
    // T_z = date.getTimeZone();
    // T_z = calender.getTimeZone();


    {
    if (M_i < 10)
    {
    (M_i = "0" + M_i); // add leading zero to min if single digit
    }
    }
    {
    if (H_r < 12)
    {
    (A_P = "am"); // set am-pm to am
    }
    }
    {
    if (H_r > 11)
    {
    (A_P = "pm"); // set am-pm to pm
    }
    }
    {
    if (H_r > 12)
    {
    (H_r = H_r-12); // change 24 hr to 12 hr system
    }
    }
    {
    if (H_r < 1)
    {
    (H_r = 12); // if hour = 0, change hour to 12
    }
    }

    // timestamp = " " + H_r + ":" + M_i + " " + A_P + " " + T_z + " : ";
    timestamp = " " + H_r + ":" + M_i + " " + A_P + " : ";

    // ++++++++++++++++++++++++++++++++++++++
    rnd++;
    chatbox = getElement( "mytext" );
    chat = chatbox.value;
    chat = timestamp + chat;
    chatbox.value = "";

    userid = location.search.substring( 1, location.search.length );
    url = 'Server.aspx?action=PostMsg&u=' + userid + '&t=' + encodeURIComponent(chat) + '&session=' + rnd;

    req = getAjax();

    req.onreadystatechange = function()
    {
    if( req.readyState == 4 && req.status == 200 )
    {
    updateAll();
    }
    }

    req.open( 'GET', url, true );
    req.send( null );
    }



    Thanks
    Last edited by ddscart; 08-01-2009 at 06:58 AM. Reason: Can't sho links: the 3w woud be www

  2. #2
    ddscart is offline Member
    Join Date
    Aug 2009
    Location
    Georgia, USA
    Posts
    2
    Rep Power
    0

    Default

    No ideas?

    Is there a system api call? Am I doing anything right? Am I even working in the right direction?

    Must be someone who will help out!

    Thanks

Similar Threads

  1. Class Time - represents time of day
    By verbazon in forum New To Java
    Replies: 1
    Last Post: 04-13-2009, 01:06 AM
  2. time Zone
    By mohammedsiddig in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 09-07-2008, 03:38 PM
  3. Replies: 21
    Last Post: 08-01-2008, 11:13 AM
  4. Hello, first time here.
    By ludragon in forum Introductions
    Replies: 2
    Last Post: 01-03-2008, 05:03 AM
  5. Replies: 0
    Last Post: 11-06-2007, 02:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •