473,405 Members | 2,287 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,405 software developers and data experts.

date formatting

How can I format a string so that only the months name (and nothing else) is
displayed?

--
cody

Freeware Tools, Games and Humour
http://www.deutronium.de.vu || http://www.deutronium.tk
Jul 21 '05 #1
3 1480
Single string or binding a DataSet to a control?

For a single string, one idea is putting the string into a DateTime object
and extracting the month. A bit weighty to simply pull a month, but it can be
extremely useful if you ever need any other parts of the data.

If you are binding multiple pieces of data, you can use the String.Format()
static method to format strings however you desire. This can also be used on
a single string, so it is quite flexible.

Here is some info:
http://idunno.org/displayBlog.aspx/2004071401
---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************

"cody" wrote:
How can I format a string so that only the months name (and nothing else) is
displayed?

--
cody

Freeware Tools, Games and Humour
http://www.deutronium.de.vu || http://www.deutronium.tk

Jul 21 '05 #2
System.DateTime has a very handy override of ToString() allowing you to show
whatever you want.

System.DateTime mydate = new System.DateTime.Today.

Response.Write(mydate.ToString("MMMM d yyyy")); // December 20, 2004
Response.Write(mydate.ToString("MMMM")); // December

etc. check it out on MSDN, you'll find more examples there.

--
Ben Strackany
www.developmentnow.com
"cody" <no****************@gmx.net> wrote in message
news:ev**************@TK2MSFTNGP15.phx.gbl...
How can I format a string so that only the months name (and nothing else) is displayed?

--
cody

Freeware Tools, Games and Humour
http://www.deutronium.de.vu || http://www.deutronium.tk

Jul 21 '05 #3
Thanks that was I was looking for.

--
cody

Freeware Tools, Games and Humour
http://www.deutronium.de.vu || http://www.deutronium.tk
"Ben Strackany" <in********@developmentnow.nospam.com> schrieb im
Newsbeitrag news:OL**************@TK2MSFTNGP09.phx.gbl...
System.DateTime has a very handy override of ToString() allowing you to show whatever you want.

System.DateTime mydate = new System.DateTime.Today.

Response.Write(mydate.ToString("MMMM d yyyy")); // December 20, 2004
Response.Write(mydate.ToString("MMMM")); // December

etc. check it out on MSDN, you'll find more examples there.

--
Ben Strackany
www.developmentnow.com
"cody" <no****************@gmx.net> wrote in message
news:ev**************@TK2MSFTNGP15.phx.gbl...
How can I format a string so that only the months name (and nothing
else) is
displayed?

--
cody

Freeware Tools, Games and Humour
http://www.deutronium.de.vu || http://www.deutronium.tk


Jul 21 '05 #4

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

Similar topics

12
by: Rob T | last post by:
I'm storing a date/time into a SQL table of type datetime. I need it to be precise so the value is stored to the 1000th of a second. ie "insert into myTable mydate values ('08/05/2005...
11
by: Rob T | last post by:
I'm storing a date/time into a SQL table of type datetime. I need it to be precise so the value is stored to the 1000th of a second. ie "insert into myTable mydate values ('08/05/2005...
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...
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...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.