Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / General / May 2004

Tip: Looking for answers? Try searching our database.

DateDiff and Javascript getTime Methods help

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Shane - 31 May 2004 05:41 GMT
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
Cor Ligthert - 31 May 2004 08:17 GMT
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/default.asp?url=/library/en-us/cpref/html/frlr
fsystemtimespanclasstopic.asp


You can also ask this kind of questions in the newsgroup

Microsoft.public.dotnet.languages.vb

I hope this helps?

Cor

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.