Solved

How to change the Year format, VB.Net 2003

Posted on 2009-04-01
4
270 Views
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.
0
Comment
Question by:chkueh
[X]
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
4 Comments
 
LVL 53

Expert Comment

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

Accepted Solution

by:
Dhaest earned 250 total points
ID: 24037758
Even some easier

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

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

Assisted Solution

by:amazingwolf1
amazingwolf1 earned 250 total points
ID: 24037767
Try:

CurrentYear  = DateTime.Now.Year.ToString()

HTH
0
 
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")
0

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 vb.net 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 (http://msdn.microsoft.com/en-us/library/system.string.aspx) 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