Is there a simple way of compare dates? I am trying to create a list of
perishable stock in an inventory that is near or past its expiration date.
I've tried telling it to compare a node's value with a DateTime string, but
that doesn't work.
I've assumed that it is easier to manipulate today's date instead of the
date in my ExpireDate element.
Thankyou in advanced for taking the time to read this and possibly helping
me
Echo 8
----------------------------------------------------------------------------
--------------------------------
My Code:
Public Function FromElement(ByVal Element As Xml.XmlElement) As Boolean
...
Const XmlDateTimeFormat As String = "yyyy-MM-dd\THH:mm:ss\Z"
...
Dim DateToCompare As Date = Now.ToUniversalTime.Subtract(New TimeSpan(7,
0, 0, 0))
Dim DateStr As String = Format(DateToCompare, XmlDateTimeFormat)
Dim ExpiredStocks As Xml.XmlNodeList
' This doesn't work
ExpiredStocks = Element.SelectNodes("child::NS:Food[ExpireDate < " &
DateStr & "]", nsm)
...
Return True
End Function
----------------------------------------------------------------------------
--------------------------------
And my xml data:
<Stocks>
<Stock ID="0001">
<ExpireDate>2004-12-31T12:00:00Z</ExpireDate>
<AmountLeft>17</AmountLeft>
</Stock>
<!-- And so forth -->
</Stocks>