IT. Expert System.

VBS

DatePart()


Description

The DatePart() function returns the specified part of a given date.

This function has the form:

DatePart(interval,date [,firstdayofweek [,firstweekofyear]])
Parameter Description
interval (required) The interval of time to return.

Can take the following values:

  • yyyy - Year
  • q - Quarter
  • m - Month
  • y - Day of year
  • d - Day
  • w - Weekday
  • ww - Week of year
  • h - Hour
  • n - Minute
  • s - Second
date (required) Date expression to evaluate
firstdayofweek (optional) Specifies the day of the week.

Can take the following values:

  • 0 = vbUseSystem
    DayOfWeek - Use National Language Support (NLS) API setting
  • 1 = vbSunday - Sunday (default)
  • 2 = vbMonday - Monday
  • 3 = vbTuesday - Tuesday
  • 4 = vbWednesday - Wednesday
  • 5 = vbThursday - Thursday
  • 6 = vbFriday - Friday
  • 7 = vbSaturday - Saturday
firstweekofyear (optional) Specifies the first week of the year.

Can take the following values:

  • 0 = vbUseSystem - Use National Language Support (NLS) API setting
  • 1 = vbFirstJan1 - Start with the week in which January 1 occurs (default)
  • 2 = vbFirstFourDays - Start with the week that has at least four days in the new year
  • 3 = vbFirstFullWeek - Start with the first full week of the new year

Examples

The following examples show the basic use of this function:

Example 1

Get the month from a date:

d = CDate("2010-02-16")
Msgbox(DatePart("m",d))

This produces the following result:

2

Example 2

Get the month we are in:

Msgbox(DatePart("m",Now()))

Example 3

Get the hour:

Msgbox(DatePart("h",Now())

Miscellaneous Information

Supported in Version: 2.0


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 1201 / 96494754. Delta: 0.04264 с