?
Solved

Custom date format

Posted on 2013-05-23
5
Medium Priority
?
411 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 1500 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

Docker-Compose to Simplify Multi-Container Builds

Our veteran DevOps Author takes you through how to build a multi-container environment, managed with a single utility in order to simplify your deployments.

Question has a verified solution.

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

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

766 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