Results 1 to 2 of 2
Thread: Time zone stamp
- 08-01-2009, 06:55 AM #1
Member
- Join Date
- Aug 2009
- Location
- Georgia, USA
- Posts
- 2
- Rep Power
- 0
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 );
}
ThanksLast edited by ddscart; 08-01-2009 at 06:58 AM. Reason: Can't sho links: the 3w woud be www
- 08-02-2009, 08:41 PM #2
Member
- Join Date
- Aug 2009
- Location
- Georgia, USA
- Posts
- 2
- Rep Power
- 0
Similar Threads
-
Class Time - represents time of day
By verbazon in forum New To JavaReplies: 1Last Post: 04-13-2009, 01:06 AM -
time Zone
By mohammedsiddig in forum JavaServer Pages (JSP) and JSTLReplies: 0Last Post: 09-07-2008, 03:38 PM -
i click on it,then first time error page comes,second time click then product page co
By 82rathi.angara in forum New To JavaReplies: 21Last Post: 08-01-2008, 11:13 AM -
Hello, first time here.
By ludragon in forum IntroductionsReplies: 2Last Post: 01-03-2008, 05:03 AM -
How to install tzdata2007i (updated Time zone database) in JDK 1.5.0_12-b04
By Santhosh in forum Advanced JavaReplies: 0Last Post: 11-06-2007, 02:16 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks