Go to DotNetFunda.com
 Online : 78 |  Welcome, Guest!   Login
 Skip Navigation Links Home > Articles > VB.NET > Numeric and Date Functions in VB.NET
  Win at least 8 gifts every month now! >> Top Performers of this month.   


Notice: If page content has been copied from other sources without proper permission, kindly let us know with details from where it has been copied for further action.

All Articles | Submit Article |

Numeric and Date Functions in VB.NET

 Posted on: 11/14/2009 2:45:56 AM by Abhisek | Views: 131 | Category: VB.NET | Level: Beginner | Print Article
This article tells about different Numeric and Date functions available in VB.NET.

Webmaster says - If this article content has been copied from other websites without proper permission, kindly let us know with details from where it has been copied for further action.

Numeric Functions in VB.NET

All the numeric functions in VB.NET are implemented as methods of the Math Class. To use any of the Math methods provided by VB.NET, you must prefix the methods with "Math.". Some of these functions and there uses are given below,

Abs(int):- This method returns the absolute value of the specified number
Dim MyNo As Double
MyNo=Math.Abs(65.45)'returns 65.45
MyNo=Math.Abs(-65.45)'returns 65.45
Min(int,int):- This function returns the smaller of two numbers specified.
Dim MyNo As Double
MyNo=Math.Min(65.45,45)'returns 45
Max(int,int):- This function returns the larger of two numbers specified.
Dim MyNo As Double
MyNo=Math.Max(65.45,45)'returns 65.45
Round(int):- It returns the rounded value of the specified number.
Dim MyNo As Double
MyNo=Math.Round(65.45)'returns 65
Pow(int,int):- This function returns a specified number raised to the specified power. If it tales two arguments a, b then it will return a^b.
Dim MyNo As Double
MyNo=Math.Pow(2,3)'returns 2^3, i.e, 8
Sqrt(int):- This function returns the square root of the specified number.
Dim MyNo As Double
MyNo=Math.Sqrt(4)'returns 2
MyNo=Math.Sqrt(36)'returns 6
Date Functions In VB.NET

In VB.NET there are also some date function such as,

Now():- This function returns a date value containing the current date and time according to your system setting.
Dim Dt As Date
Dt=Now()'returns "11/05/2009 7:30:59AM"
Today():- This function returns a date value containing the current date only.
Dim Dt As Date
Dt=Today()'returns "11/05/2009"

TimeOfDay():- It will return a date value containing only current time.
Dim Dt As Date
Dt=TimeOfDay()'returns "2:26:34"
There is also several other functions relating to date and time and also math functions. I have included only the frequently used functions.






Interesting?   Share and Bookmark this kick it on DotNetKicks.com


Experience:0 year(s)
Home page:
Member since:Sunday, October 11, 2009
Biography:Thanks and Regards
Abhisek Panda
Go Green And Save Your Future
 Latest post(s) from Abhisek

   ◘ Delegate in C# posted on 11/22/2009 8:35:52 AM
   ◘ Viewing CIL code and Assembly Metadata posted on 11/16/2009 11:51:09 PM
   ◘ Numeric and Date Functions in VB.NET posted on 11/14/2009 2:45:56 AM
   ◘ DataBase Operation In Java Using JDBC posted on 11/7/2009 8:52:51 PM
   ◘ File Handling Methods in VB.NET posted on 11/7/2009 8:37:22 PM


Submit Article

About Us | The Team | Contact Us | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
All rights reserved to DotNetFunda.Com. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks.
(Best viewed in IE 6.0+ or Firefox 2.0+ at 1024 * 768 or higher)