Click here to Skip to main content
15,920,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to get the server date time in strig using asp.net with c#
Posted

Check below

C#
DateTime dt=DateTime.Now();
string strDate=dt.ToString("MM/dd/yyyy");
 
Share this answer
 
v3
Comments
Vikas_Shukla_89 12-Oct-11 7:52am    
my +5
if you are talking about hosting server then
use this
C#
string str=datetime.now.tostring();

and put server connection string in web.config connection strings tag
 
Share this answer
 
v2
Hi,

use this line

C#
String sdate=System.DateTime.Now.ToString();


All the Best
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900