473,397 Members | 1,950 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

DateDiff and Javascript getTime Methods help

I have this peice of Javascript, im trying to convert in to VB.net. Everything work ok. I almost get the some value, but the last 5 numbers are all Zeros on my VB out put. the Java version has numbers there and makes the out a little different. I want to know if there is a better why in VB i can do this

I am taking the difference of two dates and making them in to a long intger. here is the code for both and the out put

VB.net Code
Dim days As Lon
Dim date1970 As Date = "#1/1/1970 00:00:00#
Dim datenow As Date = Date.No
Dim mseconds As Long = 24 * 60 * 60 * 100

days = DateDiff(DateInterval.Day, date1970, datenow
days = days * msecond
Label1.Text = day
Output: 108587520000

Javascript
var unij = new Date()
var unii = "?"+unij.getTime()

function write()

document.write(unij)
document.write("<br>")
document.write(unii)
Out Put
Sun May 30 21:34:25 PDT 200
?108597806501

This number 1085978065010 should be the same as 108587520000
it's almost the some but i think because of the 5 zeros the value is differen

Thank you
Shane
Jul 21 '05 #1
1 2198
Hi Shane,

Have a look at the TimeSpan and the cast method CDate as well, when you
understand it, it works very easy.

http://msdn.microsoft.com/library/de...classtopic.asp

You can also ask this kind of questions in the newsgroup

Microsoft.public.dotnet.languages.vb

I hope this helps?

Cor
Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Alex Fitzpatrick | last post by:
Just by way of introduction, I'm currently the principal developer and maintainer of the a JavaScript editor plug-in for Eclipse. https://sourceforge.net/projects/jseditor/ The plug-in as it...
4
by: Kevin Duggan | last post by:
Here is the URL of my page: http://www.kevsblues.com/CATER/din.html ________________________________________ I can not understand how to get this so the page reads "Only 9 days till...
2
by: Shane Saunders | last post by:
I trying to make a sub that works like Javascripts .getTime method. It work ok, but it does not should the time in it. The last numbers should be the time, but they are all zeros. Can anyone help...
1
by: Shane | last post by:
I have this peice of Javascript, im trying to convert in to VB.net. Everything work ok. I almost get the some value, but the last 5 numbers are all Zeros on my VB out put. the Java version has...
12
by: shlomi.schwartz | last post by:
Q: is it possible to inherit from a native object? I tried to use Date object as the base object like so: x.prototype = Date.prototype; x.prototype.constructor = x; function x(){...
1
by: Serious_Practitioner | last post by:
Thank you, VK, for your note. More info - The information that I want to present this way is about classes or seminars that will take place on given dates. For each seminar, I'd like to make the...
12
by: anj2k5 | last post by:
Hello , I want to create a function in C#.net which is equivalent to gettime(milliseconds since midnight 1st January, 1970 ) function in javascript. Actually i need to calculate unique value in...
3
by: Steve | last post by:
Hi; I'm working on a demo of using a timer on a web site that is made visible by making a div visible. My "PopIn Box" div is empty on the page. Before making it visible I used javascript to...
1
by: jock1up | last post by:
Having a problem and have tried to rework the code and check for errors, but still isn't showing right on my brower. Have also viewed it with two different browsers and cannot figure this one out. ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.