Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

convert date with asp.net c# 2.0

Posted on 2007-03-19
3
Medium Priority
?
393 Views
Last Modified: 2008-02-01
I'm getting a date value of: 1/30/2007
Need to convert it to: 2007-01-30
when the submit button is clicked I get a start date:
GMDatePicker1.Date.ToShortDateString()  //comes back as 1/30/2007

so do I need to call a function that will return it as 2007-01-30?

how do I write it?
0
Comment
Question by:fwsteal
[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
  • 2
3 Comments
 
LVL 37

Expert Comment

by:samtran0331
ID: 18749692
try this:
GMDatePicker1.Date.ToShortDateString.Format("yyyy-mm-dd")
0
 

Author Comment

by:fwsteal
ID: 18750167
string startdt = GMDatePicker1.Date.ToShortDateString.Format("yyyy-mm-dd") + " " + txtStartDate.Text;

Error:
'System.DateTime.ToShortDateString()' is a 'method', which is not valid in the given context
0
 
LVL 37

Accepted Solution

by:
samtran0331 earned 2000 total points
ID: 18750444
try just "tostring" instead of "toshortdatestring"...


        GMDatePicker1.Date.ToString("yyyy-MM-dd")
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

670 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