Solved

How to change the Year format, VB.Net 2003

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

840 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