This is a migrated thread and some comments may be shown as answers.

How to get Today date in Number format in server side

1 Answer 51 Views
UI for ASP.NET AJAX in ASP.NET MVC
This is a migrated thread and some comments may be shown as answers.
Tamim
Top achievements
Rank 1
Tamim asked on 04 Jun 2012, 09:30 AM
How to get Current date in Number format in server side e.g. Year/Month/day( 20120604000000)

Thanks
Tamim

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 06 Jun 2012, 02:49 PM
Hi Tamim,

Please try the following:
DateTime dt = DateTime.Now;
StringBuilder sb = new StringBuilder();
 
sb.Append(dt.Year);
sb.Append(string.Format("{0:00}",dt.Month));
sb.Append(string.Format("{0:00}", dt.Day));
sb.Append(string.Format("{0:00}", dt.Hour));
sb.Append(string.Format("{0:00}", dt.Minute));
sb.Append(string.Format("{0:00}", dt.Second));
         
string time = sb.ToString();

That should do the trick.

All the best,
Eyup
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
UI for ASP.NET AJAX in ASP.NET MVC
Asked by
Tamim
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or