How to change the Year format, VB.Net 2003

Posted on 2009-04-01
Last Modified: 2012-05-06
Hi, Experts...
How can i change the year for to ABC-09-0123 into ABC-2009-0123?

Below is the code that i declare:-
CurrentYear As String = Mid(Year(Now), 3, 4)
Label1.Text = "ABC" & "/" & CurrentYear & "/" & Format("0000")

Thank you.
Question by:chkueh
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 53

Expert Comment

ID: 24037730
CurrentYear As String = Mid(Year(Now), 3, 4)
Label1.Text = "ABC" & "/" & CurrentYear.ToString("yyyy") & "/" & Format("0000")
LVL 53

Accepted Solution

Dhaest earned 250 total points
ID: 24037758
Even some easier

Dim CurrentYear As String = System.DateTime.Now.Year

Label1.Text = "ABC" & "/" & CurrentYear &  "/" & Format("0000")

Assisted Solution

amazingwolf1 earned 250 total points
ID: 24037767

CurrentYear  = DateTime.Now.Year.ToString()

LVL 70

Expert Comment

by:Éric Moreau
ID: 24038030
what is Format("0000")? I think it should read

Label1.Text = "ABC" & "/" & Date.Today.Year.ToString() & "/" & YourIntegerVariable.tostring("0000")

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VB.NET Inline If statement 4 41
Find date of 2nd Thursday of each month 3 34
Need help with a query 14 39
Create a button class for use in all apps 5 19
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String ( Literal, only instead of starting and ending with w…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question