TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Syeada Sanjida Jahan
NA
67
86.7k
String was not recognized as a valid DateTime.
Jul 20 2017 2:20 AM
My problem :String was not recognized as a valid DateTime.
form:
<div class="col-xs-12 col-sm-2 col-md-3 col-lg-3">
<label for="lblToDT">
<span>To Date</span></label>
<dx:ASPxDateEdit ID="dtTo" runat="server" ClientInstanceName="dtTo" EditFormat="Custom" EnableTheming="false" DisplayFormatString="dd/MM/yyyy"
EditFormatString="dd/MM/yyyy" CssClass="form-control select">
</dx:ASPxDateEdit>
</div>
<div class="col-xs-12 col-sm-2 col-md-3 col-lg-3">
<label for="lblFromdate">
<span>From Date</span></label>
<dx:ASPxDateEdit ID="dtFrom" runat="server" ClientInstanceName="dtFrom" EditFormat="Custom" EnableTheming="false" DisplayFormatString="dd/MM/yyyy"
EditFormatString="dd/MM/yyyy" CssClass="form-control select">
</dx:ASPxDateEdit>
</div>
public static string SetDate(string date)
{
string setdate = null;
if (date != null && date != "")
{
DateTime dt = DateTime.ParseExact(date, "d/M/yyyy", CultureInfo.InvariantCulture);
// for both "1/1/2000" or "25/1/2000" formats
setdate = dt.ToString("dd/MM/yyyy");
//DateTime date1 = Convert.ToDateTime(date);
//var date2 = date1.Date;
//var D = date2.Day;
//var M = date2.Month;
//var y = date2.Year;
//string monthStr = M.ToString("00");
//setdate = D.ToString() + "/" + monthStr.ToString() + "/" + y.ToString();
}
//if (date != null && date != "")
// setdate = DateTime.Parse(date).ToString("dd/MM/yyyy", CultureInfo.InvariantCulture);
return setdate;
}
i cant not solve this code .this code is not working .its give error.please any one sovle this problem .this code asp.net c# devexpress .
sanjida
Reply
Answers (
4
)
session state management
send dev content