Get date in "YY" format

Any suggestions on how to get date in "YY" format in
example the current year is "15"

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Steven CarnahanNetwork ManagerCommented:
DateTime dt = DateTime.Now;

Open in new window

Simple enough, just use the ToString() method with the appropriate format on the date; e.g. -
Module Module1
	Sub Main()
		Dim [now] As DateTime = DateTime.Now
		For i As Integer = 0 To 20
	End Sub
End Module

Open in new window

Which produces the following output -Capture.JPGYou can go refer to here for more formats -


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RIASAuthor Commented:
Hello pony10us,

Can u suggest on how to find the date has expire depending on the month and year selected by combobox

Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

RIASAuthor Commented:
I am struggling on how to find the date has expire depending on the month and year selected by combobox

Is this in a windows form or on a website?

RIASAuthor Commented:
It is windows form
Need to
*.      Accept expiry date in the format of MM / YY
*.      Validate that the expiry date is valid
a.      Must not be more than 20 years in the future
b.      Must not expire today or in the past

RIASAuthor Commented:
Need a textbox to enter date in format MM/YY
Quite simple.  I'll post a solution on your other question.

RIASAuthor Commented:
Cheers mate!
Steven CarnahanNetwork ManagerCommented:
Thanks for jumping in Saige.  I got pulled away on a printer issue.  Looks like you were better able to help here anyway.  :)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.