Click here to Skip to main content
15,887,485 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Tray Icon Pin
Sonia Gupta10-May-07 0:10
Sonia Gupta10-May-07 0:10 
AnswerRe: Tray Icon Pin
P P Vilsad10-May-07 17:51
P P Vilsad10-May-07 17:51 
AnswerRe: Tray Icon Pin
kubben10-May-07 4:40
kubben10-May-07 4:40 
GeneralRe: Tray Icon Pin
Sonia Gupta10-May-07 18:05
Sonia Gupta10-May-07 18:05 
QuestionWorkflow Pin
s.a.Rahman9-May-07 21:33
s.a.Rahman9-May-07 21:33 
AnswerRe: Workflow Pin
Christian Graus10-May-07 2:20
protectorChristian Graus10-May-07 2:20 
Questiontotal days in three months [modified] Pin
Sonia Gupta9-May-07 21:32
Sonia Gupta9-May-07 21:32 
AnswerRe: total days in three months Pin
Arun.Immanuel9-May-07 22:51
Arun.Immanuel9-May-07 22:51 
I have this code from the net.
We can use this function to find the difference in date,month,year,time.

But it is in C#.
Please try to understand this and convert into VB.NET code.
                public   enum DateInterval
                {
                     Second, Minute, Hour, Day, Week, Month, Quarter, Year
		}

		public static long DateDiff(DateInterval Interval, System.DateTime StartDate, 
																	System.DateTime EndDate )
		{
			long lngDateDiffValue = 0;
			System.TimeSpan TS = new System.TimeSpan(EndDate.Ticks - StartDate.Ticks);
			switch (Interval)
			{
				case DateInterval.Day:
					lngDateDiffValue = (long) TS.Days;
					break;
				case DateInterval.Hour:
					lngDateDiffValue = (long)TS.TotalHours;
					break;
				case DateInterval.Minute:
					lngDateDiffValue = (long) TS.TotalMinutes;
					break;
				case DateInterval.Month:
					lngDateDiffValue = (long)( TS.Days / 30);
					break;
				case DateInterval.Quarter:
					lngDateDiffValue = (long)( (TS.Days / 30) / 3 );
					break;
				case DateInterval.Second:
					lngDateDiffValue = (long) TS.TotalSeconds;
					break;
				case DateInterval.Week:
					lngDateDiffValue = (long)( TS.Days / 7);
					break;
				case DateInterval.Year:
					lngDateDiffValue = (long)( TS.Days / 365);
					break;
			}
			return (lngDateDiffValue);
		}//end of DateDiff



DateDiff(DateInterval.Day,startdate,endDate)

Hope that helps. 

 

<div class="ForumSig">Regards,
Arun Kumar.A</div>

GeneralRe: total days in three months Pin
andyharman9-May-07 23:23
professionalandyharman9-May-07 23:23 
GeneralRe: total days in three months Pin
Arun.Immanuel10-May-07 1:32
Arun.Immanuel10-May-07 1:32 
AnswerRe: total days in three months Pin
Christian Graus10-May-07 2:19
protectorChristian Graus10-May-07 2:19 
AnswerRe: total days in three months Pin
klaydze10-May-07 17:15
klaydze10-May-07 17:15 
QuestionHow to open pdf-file with button Pin
porsti9-May-07 21:30
porsti9-May-07 21:30 
AnswerRe: How to open pdf-file with button Pin
Christian Graus10-May-07 2:21
protectorChristian Graus10-May-07 2:21 
AnswerRe: How to open pdf-file with button Pin
koolprasad200310-May-07 21:21
professionalkoolprasad200310-May-07 21:21 
Questioncrystal reports Pin
Sonia Gupta9-May-07 20:40
Sonia Gupta9-May-07 20:40 
Questionbar code ? Pin
Mr.Kode9-May-07 20:26
Mr.Kode9-May-07 20:26 
AnswerRe: bar code ? Pin
Christian Graus9-May-07 21:15
protectorChristian Graus9-May-07 21:15 
GeneralRe: bar code ? Pin
Mr.Kode9-May-07 22:38
Mr.Kode9-May-07 22:38 
GeneralRe: bar code ? Pin
Arun.Immanuel9-May-07 22:44
Arun.Immanuel9-May-07 22:44 
AnswerRe: bar code ? Pin
klaydze10-May-07 17:20
klaydze10-May-07 17:20 
QuestionHow to create a function that does not return a value? Pin
Vivek Narayanan9-May-07 20:05
Vivek Narayanan9-May-07 20:05 
AnswerRe: How to create a function that does not return a value? Pin
Christian Graus9-May-07 20:11
protectorChristian Graus9-May-07 20:11 
AnswerRe: How to create a function that does not return a value? Pin
Steven J Jowett9-May-07 23:28
Steven J Jowett9-May-07 23:28 
GeneralRe: How to create a function that does not return a value? Pin
Vivek Narayanan10-May-07 2:57
Vivek Narayanan10-May-07 2:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.