Solved

How to change the Year format, VB.Net 2003

Posted on 2009-04-01
4
267 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
  • 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 69

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
System32Int Error 8 55
Create XML 5 46
Visual Studio .Net 2012 and Crystal Reports 9 43
Trying to use colormap to replace color in png, with a gradient to transparent 7 31
This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

939 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now