473,386 Members | 1,679 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Format Date Entered by User to Month/Year

What is the code to take a date (mm/dd/yyyy) entered by the user and formatting it to Month & Year. So for example, if the user enters 1/31/2015 I want to copy it to another cell and format it to show January 2015. If the user enters 1/15/2015 I want it to format also as January 2015.

Thanks,
Michelle
May 21 '15 #1
2 1467
Expand|Select|Wrap|Line Numbers
  1. Dim now As DateTime = DateTime.Now
  2. Response.Write("<BR/>" & now.ToString("y")) 
  3.  
Output : May, 2015
May 23 '15 #2
Try this also.

Expand|Select|Wrap|Line Numbers
  1. Dim d As Date
  2. If Date.TryParse(txtDate.Text, d) Then
  3.    Response.Write(d.Month & " - " & d.Year)
  4. End If
  5.  
May 23 '15 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: amith | last post by:
hi I have written javascript for comparing two dates in US format and finding out whether the start date is greater than the end date and vice versa. In this attempt i have instantiated the...
8
by: Bob | last post by:
I passed in a DateTime object, and want to get its end date of the month. Is there a easy way to do it? Thanks.
2
by: Sun | last post by:
Hi, I display date in asp.net pages using user defined format: mydate.text=Format(dr("MyDate"), "MMM. d, yyyy"). It works fine for all pages except one. In that page, I built a dataAdapter,...
9
by: samuelberthelot | last post by:
Hi, Here is what I'm trying to achieve: The user enters in the textbox a date. It can be: 02.05.2006 or any other separator... 02052006 020506 any other formats should be forbidden. When...
1
by: mkmkmkmk | last post by:
Hi, I've a table with fields name, date of format(hr:min:sec month day, year) I'm in search of a query that displays records group by records of same date. Please help
2
by: ichew | last post by:
I have two dates - Date Joined and Actual Last Day. How do I find the YIS in for format of Years and Month from these two dates. Eg, Date Joined: 28/06/1971 and Actual Last Day: 24/01/2007, then...
3
by: =?Utf-8?B?R3V5IENvaGVu?= | last post by:
Hello how do I get the day/month/year part of a date in vb.net? sample in vb6: day(13/10/2001) = 13 month(13/10/2001) = 10 year(13/10/2001) = 2001 Thanks Guy
7
by: kkshansid | last post by:
i want to display it in date/ month/ year format <td><?php echo date("d/m/y",($row)); ?></td> output 01/01/70 <td><?php echo $row; ?></td> output 1977-08-09
3
by: vertigo262 | last post by:
this one should be pretty simple. All I want to do is formatdate in this format. Saturday, September 25, 2010 12:00 am function getRecordInfo(oLink, iIndex) { var...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.