Solved

Date format

Posted on 2006-06-23
3
247 Views
Last Modified: 2008-02-01
Hello experts,

How do I format a date in c# to read as follows;-


YYYY-MM-DD-hh.mm.ss.000000


where 000000 is the milliseconds

Many Thanks
0
Comment
Question by:claracruz
[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
3 Comments
 
LVL 7

Expert Comment

by:pradeepsudharsan
ID: 16968991
System.DateTime a1=System.DateTime.Now;
Response.Write(a1.ToString("yyy-MM-dd-hh.mm.ss.000000"));

--pradeep
0
 
LVL 7

Expert Comment

by:pradeepsudharsan
ID: 16969029
sorry
use this
System.DateTime a1=System.DateTime.Now;
Response.Write(a1.ToString("yyy-MM-dd-hh.mm.ss.mmmmmm"));

--pradeep
0
 
LVL 7

Accepted Solution

by:
pradeepsudharsan earned 500 total points
ID: 16969074
again sorry
use this
System.DateTime a1=System.DateTime.Now;
Response.Write(a1.ToString("yyy-MM-dd-hh.mm.ss.mmm"));//milli seconds
previous one for micro seconds.
i confused with "000000"

regards
--pradeep
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ASP.NET Calendar Control 5 52
orderby list (from Json) 1 43
write html in textarea and record it into a database table 3 40
Adding Rows to Grid 4 31
Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

737 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