Excel VBA Data And Time

This post will guide you how to use VBA Date and time functions to convert date and time format in MS excel VBA.

There are many Date and time Functions, which can be used to convert date and time from one format to another very effectively in excel as bellows:

Date Function Description
Date Returns the current system date.
CDate Converts a value to date.
DateAdd Returns a date to which a specified time interval has been added.
DateDiff Returns the difference between two date values.
DatePart Returns a specified part of the given date
DateSerial Returns a date for the given year, month, and date value.
FormatDateTime Returns an expression formatted as a date or time.
IsDate Returns True or False whether the supplied parameter is a valid date.
Day Returns the day(1-31) of the specified date.
Month Returns the month (1-12) of the specified date.
Year Returns a four-digit year (from 1900 to 9999) of the specified date.
MonthName Returns the name of the particular month for the specified date.
WeekDay Returns a number (1 to 7) that represents the day of the week for a given date value.
WeekDayName Returns the weekday string name for the specified day.
Time Function Description
Now Returns the current system date and time.
Hour Returns the hours between 0 and 23 that represents the hour part of the given time.
Minute Returns the minutes between 0 and 59 that represents the minutes part of the given time.
Time Returns the current system time.
TimeSerial Returns the time for a specific hour, minute and second.
TimeValue Returns the serial number for a specific time



So empty here ... leave a comment!

Leave a Reply

Your email address will not be published. Required fields are marked *