Solved

How to change the Year format, VB.Net 2003

Posted on 2009-04-01
4
271 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

695 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