[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

DataFormatString for time in asp.net

Posted on 2011-09-12
5
Medium Priority
?
422 Views
Last Modified: 2012-05-12
trying to set the dataformatstring to time format to datetime

<asp:BoundField DataField="lateduration" HeaderText="Late Duration" DataFormatString="{0:t}" ItemStyle-Width="100px" HeaderStyle-BackColor="LightGray" />

but couldnt change its format.
0
Comment
Question by:doramail05
[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
5 Comments
 
LVL 5

Expert Comment

by:Didier Vally
ID: 36527446
0
 
LVL 12

Expert Comment

by:Ramkisan Jagtap
ID: 36528112
Hi
Please try below

<asp:BoundField DataField="lateduration" HeaderText="Late Duration" htmlEncode="false" DataFormatString="{0:t}" ItemStyle-Width="100px" HeaderStyle-BackColor="LightGray" />



Regards,
Ram
0
 
LVL 1

Accepted Solution

by:
doramail05 earned 0 total points
ID: 36533660
found out that the datetime is actually in string format,

therefore using the following :


string[] strSplitDuration = e.Row.Cells[5].Text.Split(' ');

            e.Row.Cells[5].Text = strSplitDuration[4];

            if (strSplitDuration[4] == "12:00AM")
            {
                e.Row.Cells[5].Text = "-";
            }

Open in new window

0
 
LVL 1

Author Closing Comment

by:doramail05
ID: 36555864
solved
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

656 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