Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Epoch time compare 1

Status
Not open for further replies.

dle46163

IS-IT--Management
Jul 9, 2004
81
0
0
US
Hi All,

This has to be simple and I'm just missing something...I need to get the epoch time for my PC clock. I've been messing with this code:

nd = new Date();
ep = nd.getTime();

document.write(ep);

This works fine, however, I need the current epoch time excluding the seconds and milliseconds. In other words, I need the current epoch time (in milliseconds) down to the minute. Thus, when I refresh the page any time during a given minute the epoch time value remians the same! Any thoughts would be great!

-dle


 
Why not just set the seconds and milliseconds to 0 before issuing the getTime method?
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]
<head>
<title>test</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<script type="text/javascript">

var a = new Date();
a.setSeconds(0);
a.setMilliseconds(0);
alert(a.getTime());

</script>
<style type="text/css">

</style>
</head>
<body>
</body>
</html>

On a side note - I usually don't ask this in threads that I participate in, so as to not look like I'm whoring out for purple stars. But, is there any reason why you've never awarded an MVP vote for help that you've received at TT? Your profile shows that you've started 42 threads and never once thanked a person for their help by clicking the appropriate link. Surely of all the assistance you've received from this site you've found at least some of it to be helpful, otherwise why would you keep coming back? It only takes a second to do and the people that help you will certainly be appreciative. You can even go back to your threads in the past that you've started and award stars for the helpful posts there if you feel so inclined. That way your profile won't appear to be so blemished....

-kaht

Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson
[small]<P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <.</B> bites again.[/small]
 
Thanks, for the help... I swear I tried that before and it didn't work - now it does! That must mean I messed something up before. Anyway, ragarding purple stars and MVP's...it may sound stupid but I don't even know what that stuff is. If you look over the threads you'll see I always write back and thank everyone for their help. Didn't realize there was some sort of ranking system here. Anyway, I'll go back through my threads and help / thank people if it's not too late. Thanks for the info..
 
Glad you got it working.

It's a good idea to give out stars any time someone helps you. You're not limited to give one per thread, and you can award stars for any helpful post you see - even in threads you didn't start. Having a profile that shows you are always appreciative by giving out tipmaster votes will usually ensure that you'll always get plenty of help - cause most of the experts here like getting the votes.

-kaht

Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson
[small]<P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <.</B> bites again.[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top