.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Date Conversion from dd/mm/yyyy to yyyy-mm-dd

Posted By:      Posted Date: September 16, 2010    Points: 0   Category :Sql Server
Hi guys,   I need a expression to convert date format from dd/mm/yyyy to yyyy-mm-dd by using SUBSTRING, FINDSTING  COLUMN NAME: ExtractionDate   I tried something like this to get year first and later on to add mm and DD, but its not working   SUBSTRING(@[User::ExtractionDate], FINDSTRING((@[User::ExtractionDate], "/", 2)),4)   Any help much appreciated   Thanks,        

View Complete Post

More Related Resource Links

How to convert Date format from dd/MM/yyyy to mm/dd/yyyy in asp.net



         I am using a text box which captures the date from the datepicker and displays in dd/MM/yyyy format in asp.net using C#

When i try to pass this text box value into the DatTime variable i am getting the error as

"String was not recognized as a valid DateTime. "


my code goes like this

DateTime dt;




i tried to use Conver.ToDateTime() function but the same error is croping up..


Can any one plz suggest me on this.....Thnks in advance

Insert DATE to database (format 'YYYY-MM-DD')

How can I insert BIRTHDATE into column in 'YYYY-MM-DD' format. This is my code, can anyone edit my code? Tnx String = "INSERT into concfile VALUES(BIRTHDATE('" & DateTimePicker1.Text & "', 'YYYY-MM-DD'))"

how can I make field with date in format: dd/mm/yyyy ?

I have in model:[DisplayName("Publication date")] [DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}", ApplyFormatInEditMode = true)] [Required(ErrorMessage = "Publication date is required.")] public DateTime publication_date { get; set; } And in view:<div> <%: Html.LabelFor(model => model.publication_date) %> </div> <div> <%: Html.TextBoxFor(model => model.publication_date, new { @class = "datepicker" })%> <%: Html.ValidationMessageFor(model => model.publication_date) %> </div> But when I write in this field date: 30/11/2009 I see validation error: The value '30/11/2009' is not valid for publication_date.

Display date as mm/dd/yyyy instead of yyyy-mm-dd

This should be a fairly simple question. On my performancepoint reports, I would like to return the date as 08/20/2010 as opposed to 2010-08-20. I tried to follow this guide, http://wills-blog.com/?p=93 , but it is outdated and does not seem to work in this situation. Could someone point me in the right direction?

How to use compare validator with dd/MM/yyyy format of date

Hi all,  I have a form of leave application that has 2 dates, start date and end date. now i'm using the dd/MM/yyyy format for the date entry and i need to Validate end date like end date must me greater than or equal to start date. i want to do that with compare validator but its not working properly because of the Date  formats controls are using.    Currently i'm using textbox with Calendar extender ajax toolkit control.    So please help me if anybody have some hints.    Thanks in advance.

format date yyyy-MM-dd and remove 00:00:00

HiI have a very simple question.I retrive a date from my database and save it in a date variable Dim ShowDate As Date = dt.Rows(I)("ShowDate")The date look like this "2010-09-11 09:48:00"now i just want to format it so it only shows the date "2010-09-11"I have tried the following ShowDate = ShowDate.ToString("yyyy-MM-dd")but that returns "2010-09-11 00:00:00"any idea what I am doing wrong?

is there any way to work with date in this format: dd/MM/yyyy hh:mm

hi is there any way to work with date in this format: `dd/MM/yyyy hh:mm` (without second) i see only this format: `dd/MM/yyyy hh:mm:ss` i need that i can see in this format and to run search between date & time in this format i work on access-2007 and C# thank's in advance

Date format not working? {0:dd/MM/yyyy}


Hi I have a date field bound to a textbox in my DetailsView.

The format for the bound field is like so: {0:dd/MM/yyyy} and even the sample displayed in the properties dialog shows the date like so: 17/10/2007

Yet when I run the form, the date is shown like this 17.10.2007.  Is there any reason for this?

Converting SQL Server Date from mm/dd/yyyy to dd/mm/yyyy


I have a form on my website which inserts information into a table stored in sql server 2008... when I try to submit the form and I have entered a date like "08/10/2010" it works perfecting... but when trying to enter "24/10/2010" it doesn't work as the default format in SQL server is "mm/dd/yyyy" - so throws up an error saying:

The conversion of a nvarchar data type to a datetime data type resulted in an out-of-range value.
The statement has been terminated.

Also when I enter the date "08/10/2010" then submit the form, when retreiving that date on another page it displays as "10/08/2010"?!?!?!

Any help is much appreciated :)

Convert date in dd.mm.yyyy


Date on the page is displayed in the format mm.dd.yyyy, how to convert it to be displayed in the format  dd.mm.yyyy.

This is the code from the site:


whether it be something like this  <%# Convert. ??????  Eval("newsDate")%> 


Convert Date (dd-MM-YYYY) to (dd/MM/YYYY)


Dear Sir,

In my DB, there is 5000 date values are stored like "DD-MM-YYYY" Format in nvarchar datatype. For Example 18-10-2010

And when i convert into date format for the following purpose.

"Select * from tbl_master order by Convert(datetime,date_of_Appln,103)"

Its not working.

Can you help me to convert? or Can you help me to replace the "-" symbol to "/"?

Thanks in advance.



Date Format (dd/mm/yyyy)


  hi all

i want to display date like 20/03/2010 in a label control

i tried below but it doesnt work

<asp:Label ID="lbl1" runat="server" Text='<%#Eval("date","{0:dd MM YY}")%>'></asp:Label> 

Date type for date in format DD/MM/YYYY


Hi i need to save date  format DD/MM/YYYY

can somebody tells me what format should i use when creating mt table (datatype)

Date values...How to add a time into the value (ie mm/dd/yyyy 23:59:00)?



I have a SQL query:

ALTER PROCEDURE dbo.GetDownloadDetails_Date
 (@StartDate DateTime,
 @EndDate DateTime)
 SELECT     StatusDate, ProgramName, UserFullName, LoginName, CostCenterCode, EmailAddress, Phone, Manager, ComputerName, SCCMSiteCode, Status,
                       FailureReason, PONumber
 FROM         Installs
 WHERE     StatusDate BETWEEN @Startdate AND @EndDate
 ORDER BY StatusDate

If the user selects a date range, the last day isn't populated, or if they select a single date, that date isn't displayed.  I know the reason as it's because the Statusdate is a DateTime...I manually entered, for the @EndDate 04-10-2011 23:59:00 for the @EndDate and the report generated.

So my question is how can I automatically update the @EndDate to include the time 23:59:00?

Conversion from string to type 'Date' is not valid



Im receiving a strange error Error Message: Conversion from string "15/08/2010 22:21:35" to type 'Date' is not valid.

I know this is generally down to cultural date formats etc, however the reason this is strange is it just randomly occured twice in the last week, the website has been running since october and nothing has changed,

The error constantly occured until the IIS was reset and recompilled the site, its been running fine since, however im just trying to figure out what could cause such an error to occur.

I've narrowed it down to a line of code which is:

bktime = DReader.Item("Bktime").ToString

bktime = Year(CDate(bktime)) & "-" & fmt(Month(CDate(bktime)), 2) & "-" & fmt(Day(CDate(bktime)), 2)

Has anyone else encountered this randomly occuring and is there anything i can put in place to prevent this in future?



How Convert Datetime (YYYY/MM/dd HH:mm:ss) To yyyy-MM-dd



How do you write a date value to an XMLElement in .NET 3.5 XMLDocument object. 


 I am using the following:


DateTime orderDate = new DateTime();
orderDate = DateTime.Now; // 2010-08-24 16:45:46

string st = XmlConvert.ToString(orderDate, "yyyy-MM-dd");     // st="2010-08-24"
DateTime dt2 = XmlConvert.ToDateTime (st, "yyyy-MM-dd");   // dt2 = "2010-08-24 00:00:00"

I would like to remove the time section "00:00:00". I only need to write a date in the XML file with the following format :


Order date is defined like this in the xsd file : <xs:element name="OrderDate" type="xs:date"/>


Thanks for your support.

Asp.net Javascript Validation dd/mm/yyyy format


Hi experts,

 I am trying to validate two textbox (fromdate,todate)

should alert a message when Fromdate is more than Todate

I could find only mm/dd/yyyy format in most of google search.

please give me a script or assist how to do this.



ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend