473,387 Members | 1,597 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,387 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 2195
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.