Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

dates

 

is this a good way to compare dates?

chk = (dt.AddDays(30).ToString < Date.Now.ToString)

 

i hope its comparing the dates and not the string length...as i think.

but the final result is ok..(i guess)

 

the dt date is a date which i took out from a file.

im trying to make a time evaluation...

Edited by FlyBoy
Posted
You don't need to convert to strings to compare dates - just compare the dates:

chk = (dt.AddDays(30) < Date.Now)

 

i've tried that ....and it didnt work. but somehow now it works...maybe it was someting with my syntax which i havent noticed.

thanks!!!!

 

btw...when i should use the "timespan" thing??

 

read about it in msdn...but still cant figure it out. :confused: :confused:

Posted
You would use a timespan if you need to keep track of an arbitrary range of time (like the difference between two dates)

       Dim ts As TimeSpan
       ts = dt.AddDays(30).Subtract(Date.Now)

 

i see...thank u very very much!!

  • *Experts*
Posted
It looks like you might be setting up a 30-day demo of your software. If so you might also consider using a Julian date to eliminate any international date format problems and save a value rather than a date using CInt(Now().ToOADate). Then just subtract the current day value from the installation value.

Member, in good standing, of the elite fraternity of mentally challenged programmers.

 

Dolphins Software

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...