Solved

Custom date format

Posted on 2013-05-23
5
409 Views
Last Modified: 2013-05-28
Hi Experts,
I have a date field in mm/dd/yyyy format in database.  In my aspx page I need to display in 24/MAY/2013 format.  So I am using DataFormatString="{0:dd/MMM/yyyy}".  But it displays 24/May/2013.  How can I display as 24/MAY/2013 or month changed to Uppercase?

Thank you very much for your help and time.
0
Comment
Question by:RadhaKrishnaKiJaya
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 30

Expert Comment

by:anarki_jimbel
ID: 39192630
Try:

            DateTime d = new DateTime(2013, 5, 22);

            string ds = d.ToString("{dd/MMM/yyyy}").ToUpper();
            MessageBox.Show(ds);

Open in new window

0
 

Author Comment

by:RadhaKrishnaKiJaya
ID: 39192649
Thank you anarki_jimbel,
I need it in a gridview.  Currently I am using DataFormatString="{0:dd/MMM/yyyy}", but the month is always in proper case.  I need month uppercase such as 23/MAY/2013.  Thank you again!
0
 
LVL 30

Assisted Solution

by:anarki_jimbel
anarki_jimbel earned 500 total points
ID: 39192787
0
 

Accepted Solution

by:
RadhaKrishnaKiJaya earned 0 total points
ID: 39193207
This one returns months as Jan, Feb etc.  I need JAN, FEB etc.  I found the solution already.  Here is what I am doing in DataBind and worked fine.  Thank you for you quick response and time.

string BirthDay = e.Row.Cells[0].Text;

e.Row.Cells[0].Text = BirthDay.Substring(0, 2) + "/" + StartDate.Substring(3, 3).ToUpper() + "/" + StartDate.Substring(7, 4);.
0
 

Author Closing Comment

by:RadhaKrishnaKiJaya
ID: 39200685
Thank you.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

691 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