Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old June 23rd, 2008, 02:12 AM
Authorized User
Join Date: May 2007
Posts: 95
Thanks: 5
Thanked 0 Times in 0 Posts
Default Date format problem

Hi all

In my web application(developing using C#, ASP.NET 2.0), i m showing date to the user for last 7 days starting from today's date in the form Monday, June 23, 2008.
code is:
string strDdlDate;

for (int intDay = 7; intDay > 1; intDay--)
            //strPass = DateTime.Now.ToString();
            strDdlDate = DateTime.Now.AddDays(intDay-7).ToLongDateString();
            ddlDate.Items.Insert(0, new ListItem(strDdlDate, strDdlDate));
        ddlDate.SelectedValue = DateTime.Now.ToLongDateString();

I am loading all these dates in the dropdown. Now the problem is that if the user selects any date it will be in the form as i have mentioned above. How can i convert the selected date into MM/DD/YYYY format, so that i can pass it to Database.

-- Abhishek

Old June 23rd, 2008, 02:25 AM
Authorized User
Join Date: May 2007
Posts: 95
Thanks: 5
Thanked 0 Times in 0 Posts

Hi all

i solved the problem by using Convert.ToDateTime :)

Similar Threads
Thread Thread Starter Forum Replies Last Post
Date Format Problem cyberddindia Classic ASP Basics 2 October 23rd, 2006 01:49 AM
Date Format Problem Scripts82 Access VBA 2 March 13th, 2006 09:36 PM
Date format problem ERC Crystal Reports 1 June 15th, 2005 04:03 AM
Date format problem widad Classic ASP Basics 1 October 15th, 2004 06:31 PM
Date Format problem in Oracle ppenn Oracle ASP 1 May 10th, 2004 06:00 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.