Buy Questpond's video subscriptions on
huge discount
.
Online: 907
Home
Articles
Interviews
Forums
For Beginners
Popular Questions
ITIL Career Advice
PMP Career Advice
Career Advices
Codes
Videos
ASP.NET
ASP.NET MVC
Android Intel XDK
Sql Server
AngularJS
Bootstrap
Backbone.JS
MongoDB
LESS (CSS)
jQuery
WPF
WWF
SSIS
LightSwitch
Tutorials
News
ASP.NET MVC
|
Be Interview Ready
|
Top Performers
|
DNF MVP
|
Top Posts
|
Winners
|
Subscribe
|
Catalogs
Welcome Guest !
Register
Login
Home
>
Forums
>
C#
>
Loading ...
Code for Time format in c# [Resolved]
Posted by
Allemahesh
under
C#
on 7/15/2013 |
Points: 10
| Views : 1812 | Status :
[Member]
[MVP]
| Replies : 6
Write New Post
|
Search Forums
|
Resolved Posts
|
Un Answered Posts
|
Forums Home
I am using c#. I want to display only time in the below format.
HH-mm-ss tt.
Can any one help me.
[Resolved]
Reply
|
Reply with Attachment
Alert Moderator
Responses
Posted by:
Prtkaggrwl
on: 7/15/2013
[Member]
Starter
|
Points: 50
0
Response.Write(DateTime.Now.ToString("HH-mm-ss tt"));
Allemahesh
, if this helps please
login
to
Mark As Answer
. |
Alert Moderator
Posted by:
Ganeshjoshi
on: 7/15/2013
[Member]
Starter
|
Points: 25
0
Hi,
You can use this code
using System;
static void Main() {
DateTime dateTime = DateTime.Now;
Console.WriteLine ("T = {0:T}", dateTime ); // hh:mm:ss AM/PM
}
Hope this information is helpful to you...
Thanks
Regards,
ganesh joshi
Allemahesh
, if this helps please
login
to
Mark As Answer
. |
Alert Moderator
Posted by:
Allemahesh
on: 7/15/2013
[Member]
[MVP]
Silver
|
Points: 25
0
But How I can use in my asp.net .cs file.
Allemahesh
, if this helps please
login
to
Mark As Answer
. |
Alert Moderator
Posted by:
Saclines
on: 8/2/2013
[Member]
Starter
|
Points: 25
0
Get the list of other formatting options here
http://www.dotnetlines.com/Blogs/tabid/85/EntryId/8/DateTime-ToString-Formats.aspx
Sachin N. S.
Allemahesh
, if this helps please
login
to
Mark As Answer
. |
Alert Moderator
Posted by:
sudha29-23275
on: 8/2/2013
[Member]
Starter
|
Points: 25
0
string time = DateTime.Now.ToString("HH:mm:ss tt");
Console.WriteLine(time);
Console.ReadKey();
Allemahesh
, if this helps please
login
to
Mark As Answer
. |
Alert Moderator
Posted by:
Veeru.5588
on: 8/3/2013
[Member]
Starter
|
Points: 25
0
Hi,
use this code
using System;
static void Main()
{
DateTime dateTime = DateTime.Now;
Console.WriteLine ("T = {0:T}", dateTime ); // hh:mm:ss AM/PM
}
Allemahesh
, if this helps please
login
to
Mark As Answer
. |
Alert Moderator
Login to post response
Latest Posts
How white label Uber app clone can help you start a taxi business like Uber?
(0)
Iterating over columns of dataframe and print as rows in Python Django
(0)
Where can I found sample MVC projects to learn and improve skills
(1)
Extract a value from HTML string
(0)
Get only year part from date string in SQL server
(0)
django.template.exceptions.TemplateDoesNotExist: AlgoDash/index.html
(0)
How to find particular URL from within anchor tag using JavaScript or jQuery
(0)
How to handle 302 status (Moved temporalily)
(1)
More ...