473,394 Members | 1,797 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,394 software developers and data experts.

custom date formatting

All -

I have VB2008. On the form I have a date picker and a text box.
I put would like to display a date format in the form of "MM-DD-YYYY" or
"MM-YYYY"
I am new to vb2008, can you show me how to do this?

Thank you,

Ben

--

Oct 9 '08 #1
6 3459
On Oct 9, 11:03 pm, Ben <B...@discussions.microsoft.comwrote:
All -

I have VB2008. On the form I have a date picker and a text box.
I put would like to display a date format in the form of "MM-DD-YYYY" or
"MM-YYYY"
I am new to vb2008, can you show me how to do this?

Thank you,

Ben

--
Assuming you have a "DateTimePicker" control on your form, first
change DateTimePicker's "Format" property to "Custom" then set its
"CustomFormat" property to "mm-dd-yyyy" (without quotes, of course)
through properties window. Follow the same for "mm-yyyy" format.

Now you can show it in your textbox like that;
TextBox1.Text = DateTimePicker1.Text

Hope this helps,

Onur Güzel

Oct 9 '08 #2

"Ben" <Be*@discussions.microsoft.comwrote in message
news:ED**********************************@microsof t.com...
All -

I have VB2008. On the form I have a date picker and a text box.
I put would like to display a date format in the form of "MM-DD-YYYY" or
"MM-YYYY"
I am new to vb2008, can you show me how to do this?

Thank you,

Ben
Set the Format property and then set Custom Format to "MM-DD-YYYY" or
whatever
Oct 9 '08 #3
Ben,

You can custom a date to any format, some are predifined others not.

By instance with

String x = Now.ToString("MM-dd-yyyy")

Be aware that the month is with upper caption, as lower caption means
minutes.

Cor
"Ben" <Be*@discussions.microsoft.comschreef in bericht
news:ED**********************************@microsof t.com...
All -

I have VB2008. On the form I have a date picker and a text box.
I put would like to display a date format in the form of "MM-DD-YYYY" or
"MM-YYYY"
I am new to vb2008, can you show me how to do this?

Thank you,

Ben

--
Oct 10 '08 #4
On Oct 9, 11:27*pm, kimiraikkonen <kimiraikkone...@gmail.comwrote:
On Oct 9, 11:03 pm, Ben <B...@discussions.microsoft.comwrote:
All -
I have *VB2008. *On the form I have a date picker and a text box.
I put would like to display a date format in the form of "MM-DD-YYYY" or
"MM-YYYY"
I am new to vb2008, can you show me how to do this?
Thank you,
Ben
--

Assuming you have a "DateTimePicker" control on your form, first
change DateTimePicker's "Format" property to "Custom" then set its
"CustomFormat" property to "mm-dd-yyyy" (without quotes, of course)
through properties window. Follow the same for "mm-yyyy" format.

Now you can show it in your textbox like that;
TextBox1.Text = DateTimePicker1.Text

Hope this helps,

Onur Güzel
To make a correction for myself, you can use "MM-dd-yyyy" to get date
format as uppercase "MM" represents month value whereas lowercase "mm"
represents minutes. Same, you can use "MM-YYYY" as date.

And sure, you can use Short, Long formats which are presented
alreadyby DateTimePicker.

Thanks,

Onur Güzel
Oct 10 '08 #5
Onur,

I saw it, but did not know how to phrase it, therefore I made a new message.

:-)

Cor

"kimiraikkonen" <ki*************@gmail.comschreef in bericht
news:f2**********************************@8g2000hs e.googlegroups.com...
On Oct 9, 11:27 pm, kimiraikkonen <kimiraikkone...@gmail.comwrote:
On Oct 9, 11:03 pm, Ben <B...@discussions.microsoft.comwrote:
All -
I have VB2008. On the form I have a date picker and a text box.
I put would like to display a date format in the form of "MM-DD-YYYY" or
"MM-YYYY"
I am new to vb2008, can you show me how to do this?
Thank you,
Ben
--

Assuming you have a "DateTimePicker" control on your form, first
change DateTimePicker's "Format" property to "Custom" then set its
"CustomFormat" property to "mm-dd-yyyy" (without quotes, of course)
through properties window. Follow the same for "mm-yyyy" format.

Now you can show it in your textbox like that;
TextBox1.Text = DateTimePicker1.Text

Hope this helps,

Onur Güzel
To make a correction for myself, you can use "MM-dd-yyyy" to get date
format as uppercase "MM" represents month value whereas lowercase "mm"
represents minutes. Same, you can use "MM-YYYY" as date.

And sure, you can use Short, Long formats which are presented
alreadyby DateTimePicker.

Thanks,

Onur Güzel
Oct 10 '08 #6
Thank you all

Ben

--

"Ben" wrote:
All -

I have VB2008. On the form I have a date picker and a text box.
I put would like to display a date format in the form of "MM-DD-YYYY" or
"MM-YYYY"
I am new to vb2008, can you show me how to do this?

Thank you,

Ben

--
Oct 10 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: Dales | last post by:
I have a custom control that builds what we refer to as "Formlets" around some content in a page. These are basically content "wrapper" sections that are tables that have a colored header and...
4
by: Paul | last post by:
Hi, Everything went fine getting a short date format out of SQL into my DataGrid with this: <%# DataBinder.Eval(Container.DataItem, "Created", "{0:d}")%> Then I got too fancy in SQL and...
2
by: IM | last post by:
hi, I took out a part of my code so I can get some help. objWriter.WriteStartElement("item"); // start of the "item" element - one for each article objWriter.WriteElementString("title",...
2
by: johndcal | last post by:
Hello All, I have a date value that I pull from a .csv file. After reading the file and storing the values in an array the value of the date could be found in $array, for example....
2
by: David Veeneman | last post by:
How does one format a date column in a GridView control? I had assumed that the DataFormat string would do it, but MSDN only shows numeric formatting codes. Can dates be formatted using that...
2
by: rickholt | last post by:
Many years ago at IBM we had a text formatting language (DCF) which let you specify all sorts of microcommands to a page formatter. Not particularly exciting, but it was also a primitive...
3
by: Jim in Arizona | last post by:
I have a gridview that's being populated from an access db query. The problem I'm having is that the date/time fields in access that are populating the gridview are showing both date and time, when...
7
by: creative1 | last post by:
Hello everyone. I am experiencing a strange problem that I can't fix on my own. I think I need expert's suggestions for this. The problem is: I want to print account statement (or any other...
9
by: Martin | last post by:
I'm retrieving some records from a database. One of the fields contains a date/time. I would like to format it as I send it out to the table in the displayed page. Can some one please tell me...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.