pvg1975
asked on
Date in format yyyyMMdd
Hello all,
I have a legacy database from where I retrieve a field (INT) that is supposed to be a date, in the format yyyyMMdd, for example 20111014 for today.
What I need to know is if that date, let's say...
Dim DBdate as integer = 20111014
... is in between today minus 31 days range.
Is this possible?
Thanks!
Paula
I have a legacy database from where I retrieve a field (INT) that is supposed to be a date, in the format yyyyMMdd, for example 20111014 for today.
What I need to know is if that date, let's say...
Dim DBdate as integer = 20111014
... is in between today minus 31 days range.
Is this possible?
Thanks!
Paula
Change line 10 above to:
if (date > DateTime.Now - span && date <= DateTime.Now)
...technically, you probably should also set a local var dateNow instead of using the .Now property twice.
(Still don't know why I can't edit a post...)
if (date > DateTime.Now - span && date <= DateTime.Now)
...technically, you probably should also set a local var dateNow instead of using the .Now property twice.
(Still don't know why I can't edit a post...)
ASKER
Hi Slimfinger,
Line 8 killed me, Im working on VB instead of C#
Line 8 killed me, Im working on VB instead of C#
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window