home *** CD-ROM | disk | FTP | other *** search
/ ftp.tcs3.com / ftp.tcs3.com.tar / ftp.tcs3.com / DRIVERS / Audio / Office2010 / InfoPath.en-us / InfLR.cab / FL_DeterminetheSpanbetweenTwoDates_snippet_142643_ENU____.3643236F_FC70_11D3_A536_0090278A1BB8 < prev    next >
Extensible Markup Language  |  2008-09-17  |  2KB  |  41 lines

  1. ∩╗┐<?xml version="1.0" encoding="UTF-8"?>
  2. <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  3.   <CodeSnippet Format="1.0.0">
  4.     <Header>
  5.       <Title>Determine the Span between Two Dates </Title>
  6.       <Author>Microsoft Corporation</Author>
  7.       <Description>Calculates the difference in days between two dates and also constructs a TimeSpan value for that difference.</Description>
  8.       <Keywords>
  9.       </Keywords>
  10.       <Shortcut>typeDate</Shortcut>
  11.     </Header>
  12.     <Snippet>
  13.       <Imports>
  14.         <Import>
  15.           <Namespace>Microsoft.VisualBasic</Namespace>
  16.         </Import>
  17.         <Import>
  18.           <Namespace>System</Namespace>
  19.         </Import>
  20.       </Imports>
  21.       <Declarations>
  22.         <Literal>
  23.           <ID>dateLiteral</ID>
  24.           <Type />
  25.           <ToolTip>Replace with a date literal, a date variable, or a method that returns a date.</ToolTip>
  26.           <Default>#1/1/2002#</Default>
  27.         </Literal>
  28.         <Literal>
  29.           <ID>dateLiteral2</ID>
  30.           <Type />
  31.           <ToolTip>Replace with a date literal, a date variable, or a method that returns a date.</ToolTip>
  32.           <Default>Now</Default>
  33.         </Literal>
  34.       </Declarations>
  35.       <Code Language="VB" Kind="method body"><![CDATA[Dim oldDate As Date = $dateLiteral$
  36. Dim newDate As Date = $dateLiteral2$
  37. Dim differenceInDays As Long = DateDiff(DateInterval.Day, oldDate, newDate)
  38. Dim spanFromDays As TimeSpan = New TimeSpan(CInt(differenceInDays), 0, 0, 0)]]></Code>
  39.     </Snippet>
  40.   </CodeSnippet>
  41. </CodeSnippets>