English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I'va made this java script program that should tell what time it is but it does nothing. can anyone help me because I need to fix the problrm in 3 hours.
"http://http://www.w3.org/TR/html4/loose.dtd">


sam's assignment




UTC time is



local time is


2006-06-30 16:38:24 · 4 answers · asked by wormhole 2 in Computers & Internet Programming & Design

4 answers

This snippet works for me.



I messed around with your code, and it seems that capitalization was to blame. Capitalize 'Date' in "var localtime = new Date();", and make sure methods 'toLocaleString' and 'toUTCString' are properly camel-cased.

2006-06-30 18:17:04 · answer #1 · answered by billyboy 3 · 2 0

1. replace the 'type =="text/javascript"' with 'type="text/javascript"' (remove the extranous equal sign).
2. Make sure you use correct casing (use Date() instead of date()) - Javascript is case-sensitive

2006-06-30 17:57:56 · answer #2 · answered by mikos 3 · 0 0

Try using the Write(Date()) command. It displays the time/date.

2006-06-30 16:59:48 · answer #3 · answered by _anonymous_ 4 · 0 0

You are using a deprecated method. The following code gets the user's local time:

import java.lang.*;
import java.util.*;

public class date {

public static void main(String[] args) {

Date date = new Date();
String time = date.toString();
System.out.println("Date: " + time);
time = time.substring(11, time.length() - 8);
System.out.println("Time: " + time);

}

}

I'm not sure how to implement this into your html, but I hope this helps.

2006-06-30 17:12:50 · answer #4 · answered by richman1068 1 · 0 0

fedest.com, questions and answers