I have a simple application that handles authentication, and one of the
things it checks is password aging. If I have something like this:
If ("02/14/2007" <= Date.Today.ToSt ring("MM/dd/yyyy")) Then
Messagebox.Show ("Date specified is less than current")
Else
Messagebox.Show ("Date specified is greater than current")
End If
This is causing problems with authentication, as the future date, when
it rolls into another calander year, this expression consistently
returns that the date specified is less than the current date, even if
the date is 01/01/2007 and the current date is 12/31/2006. I haven't
yet found a way around this short of iterating through each number in
the date starting with the year.. Any suggestions? 5 1340
Try converting it to a real date, or reverse the order
of the date format so it's 2007/02/14.
Robin S.
-------------------------------------------
"Kevin" <km******@gmail .comwrote in message
news:11******** **************@ n51g2000cwc.goo glegroups.com.. .
>I have a simple application that handles authentication, and one of the
things it checks is password aging. If I have something like this:
If ("02/14/2007" <= Date.Today.ToSt ring("MM/dd/yyyy")) Then
Messagebox.Show ("Date specified is less than current")
Else
Messagebox.Show ("Date specified is greater than current")
End If
This is causing problems with authentication, as the future date, when
it rolls into another calander year, this expression consistently
returns that the date specified is less than the current date, even if
the date is 01/01/2007 and the current date is 12/31/2006. I haven't
yet found a way around this short of iterating through each number in
the date starting with the year.. Any suggestions?
Your prime issue is that the test you are performing is "02/14/2007" <=
"12/31/2006".
The first character of the string on the left is logically less than the the
first character of the string on the right ("0" < "1") therefore the result
is true.
If you just deal with the values as dates then you will be fine:
Dim _d As New DateTime(2007, 2, 14)
If _d <= Datetime.Today Then
...
I also thingk that you have a logic issue with you test. You are testing for
<= (less than or equal to). This will give a result of true when the 2 dates
are the same and therefore your message is inappropriate. I think your test
should simply be for < (less than).
"Kevin" <km******@gmail .comwrote in message
news:11******** **************@ n51g2000cwc.goo glegroups.com.. .
>I have a simple application that handles authentication, and one of the
things it checks is password aging. If I have something like this:
If ("02/14/2007" <= Date.Today.ToSt ring("MM/dd/yyyy")) Then
Messagebox.Show ("Date specified is less than current")
Else
Messagebox.Show ("Date specified is greater than current")
End If
This is causing problems with authentication, as the future date, when
it rolls into another calander year, this expression consistently
returns that the date specified is less than the current date, even if
the date is 01/01/2007 and the current date is 12/31/2006. I haven't
yet found a way around this short of iterating through each number in
the date starting with the year.. Any suggestions?
Thanks! That worked.
Stephany Young wrote:
Your prime issue is that the test you are performing is "02/14/2007" <=
"12/31/2006".
The first character of the string on the left is logically less than the the
first character of the string on the right ("0" < "1") therefore the result
is true.
If you just deal with the values as dates then you will be fine:
Dim _d As New DateTime(2007, 2, 14)
If _d <= Datetime.Today Then
...
I also thingk that you have a logic issue with you test. You are testing for
<= (less than or equal to). This will give a result of true when the 2 dates
are the same and therefore your message is inappropriate. I think your test
should simply be for < (less than).
"Kevin" <km******@gmail .comwrote in message
news:11******** **************@ n51g2000cwc.goo glegroups.com.. .
I have a simple application that handles authentication, and one of the
things it checks is password aging. If I have something like this:
If ("02/14/2007" <= Date.Today.ToSt ring("MM/dd/yyyy")) Then
Messagebox.Show ("Date specified is less than current")
Else
Messagebox.Show ("Date specified is greater than current")
End If
This is causing problems with authentication, as the future date, when
it rolls into another calander year, this expression consistently
returns that the date specified is less than the current date, even if
the date is 01/01/2007 and the current date is 12/31/2006. I haven't
yet found a way around this short of iterating through each number in
the date starting with the year.. Any suggestions?
Kevin,
The most made error is that if people want to compare dates they still take
the date and time.
To compare Dates you can use on both sides DateTime.Date
I hope this gives an idea,
Cor
"Kevin" <km******@gmail .comwrote in message
news:11******** **************@ n51g2000cwc.goo glegroups.com.. .
>I have a simple application that handles authentication, and one of the
things it checks is password aging. If I have something like this:
If ("02/14/2007" <= Date.Today.ToSt ring("MM/dd/yyyy")) Then
Messagebox.Show ("Date specified is less than current")
Else
Messagebox.Show ("Date specified is greater than current")
End If
This is causing problems with authentication, as the future date, when
it rolls into another calander year, this expression consistently
returns that the date specified is less than the current date, even if
the date is 01/01/2007 and the current date is 12/31/2006. I haven't
yet found a way around this short of iterating through each number in
the date starting with the year.. Any suggestions?
Try enclosing the literal date in Pound-signs ie: if ( #02/14/2007# <= ...
otherwise you're comparing a string to a date.
HTH This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Raven |
last post by:
Using either MySQL functions or PHP, how can I convert a date filed in the
format of (varchar)
Aug 10, 1950
to a unix timestamp?
tia
|
by: kmeds |
last post by:
I am creating a news script in ASP 3.0 with SQL 2000 backend. I'm new
to SQL (I used to use Access exclusively... :( )
In any case I have a database of the News set up like this"
NewsIDNum int ident
NewsTitle char
NewsDate smalldate
NewsText Text
When I'm writing to the page I'm putting
|
by: Rob |
last post by:
Hello,
I get an date field as a part of download in the format 01 Mar 04
12:00:00.
I want this to be converted as a short date.How do i proceed?
Also not connected with the above but in the same table,i do a
download and
then compare it to a previous table and do a unmatched query.Whichever
ID's do not match,I need to delete,but my delete query does not
fire.The query is a simple one to one join of both the tables.
Any suggestions?
|
by: asreryll |
last post by:
I wish to show a future date in a table, so that I can sort and know
which case is in need of a review. I can display a future date in a
form but I want to see all records that are due on a certain date.
Any help would be appreciated.
Regards
G.K.
|
by: Kevin Vaughn |
last post by:
I am trying to convert a date from this format:
yyyymmddHHMMSS.mmmmmmsUUU
to a format that ASP.NET (VB.NET) understands.
The above date format is used by the WMI datetime type. I don't care about
the mmmmmmsUUU part, as that counts milliseconds and microseconds. The sUUU
is a three digit offset indicating the number of minutes that the
originating time zone deviates from UTC. Other than that, the format is
| |
by: rohayre |
last post by:
Im a long time java developer and actually have never done anything
with java scripting. I'd like to write a short simple script for
calculating a date in the future based on today's date and a letter.
Can I use javascripting to create a webpage to allow a user to enter a
letter and then click a button to find a future calendar date? I'm just
not sure how much user interaction scripting allows. Does java
scripting allow buttons, textfields...
|
by: Killer42 |
last post by:
Hi all.
I have an interesting situation; searching a Date field for my exact value fails, but including it in a range works.
I know this sounds like the usual beginner's date/time woes but I don't believe it is. The reason for the "Date/time precision" title is that I would like to know whether anyone can tell me to what precision a date/time value is stored in Access. And how it might be affecting my search. (I have spent some time...
|
by: =?Utf-8?B?Sm9ubnk=?= |
last post by:
I have an ASP.NET 2.0 C# web application that is contacting an Exchange
server using WEBDAV. It allows the users to look up appointments for a
future date. The problem I have is determining the correct client time zone.
Note that Exchange stores everything in UTC time.
I am able currently able to use javascript to ask the client what time zone
they are in, but this is only for the "today" (the current day) and not for a
day in the...
|
by: jmartmem |
last post by:
Greetings,
I have an ASP page with a form (form1) that contains a JavaScript validation function that is activated onSubmit. The function contains a series of IF statements to alert the user to any blanks contained in the form elements.
What I want to do is add a new IF statement to the function that checks whether the user has populated a date field (entry_date01) with a date that is in the future. In other words, the user can input the...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |