Return Date Parts With VBScript

Return Date Parts With VBScript

Browsers Targeted: Internet Explorer 4+

You can retrieve any component of a date (either as a string, a hash-delimited date expression, or a date object) with the DatePart() function in Visual Basic. As with both DateAdd() and DateDiff, you specify an interval token and the function returns the part of the date given by the token.

For example, suppose that you wanted to retrieve the current day of the week (with Sunday being 1). The code for this retrieval is quite simple:

 	

The token intervals are given here:

Interval Token Interval Meaning Function Call
N/A Now Now
yyyy Year DatePart(“yyyy”,Now)
q Quarter DatePart(“q”,Now)
m Month DatePart(“m”,Now)
y Day in Year DatePart(“y”,Now)
w weekday DatePart(“w”,Now)
ww week in year DatePart(“ww”,Now)
h Hour DatePart(“h”,Now)
n Minute DatePart(“n”,Now)
s Second DatePart(“s”,Now)
Share the Post:
data observability

Data Observability Explained

Data is the lifeblood of any successful business, as it is the driving force behind critical decision-making, insight generation, and strategic development. However, due to its intricate nature, ensuring the

Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved