Solved

convert date with asp.net c# 2.0

Posted on 2007-03-19
3
372 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
  • 2
3 Comments
 
LVL 37

Expert Comment

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

Author Comment

by:fwsteal
Comment Utility
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 500 total points
Comment Utility
try just "tostring" instead of "toshortdatestring"...


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

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
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…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

771 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now