.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

How to remove a letter word from a desired date format

Posted By:      Posted Date: September 15, 2010    Points: 0   Category :Sql Server
Hi, I have a requirement where I need to format the date in “YYYYMMDDHHMMSS” format and generate XML file. Since there is a space in the table in betweenDay and Hours so that a letter T appears in the actual XML file when the XML is getting generated as : Value in the table as : 2010-09-07X 00:00:00.000 - A blank space is there in the X place .. Value of the XML O/p as   <AccountingValueDate>2010-09-03T13:31:20.803</AccountingValueDate> --Where we can see a T appears which I want to remove The query is below: Select  AD.deliveryDate FROM Product.Account AD I have tried something like below but it is not working: Select  CONVERT(VARCHAR(19),AD.deliveryDate , 120)  FROM Product.Account AD but it's not giving me the desired O/P My actual requirement is I just want to remove the T from my XML output and format the date as  YYYYMMDDHHMMSS Please somebody suggest me how to do this asap... I am using SQL Server 2008 version. Thanks a lot -pep      

View Complete Post

More Related Resource Links

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?

How To Set a Date Format In GridView Using ASP.NET 2.0

A very common desire is to set a column of a gridview to display just the month, day and year of a DateTime type. The problem is the by default, the HtmlEncode property of the boundfield attribute (
The problem is that if this field is enabled, you can not pass format information to the boundfield control. That is, if you try the following code, you will not get the desired result.

How to format datetime & date with century?

Execute the following Microsoft SQL Server T-SQL datetime, date and time formatting scripts in Management Studio Query Editor to demonstrate the usage of the multitude of temporal data formats available and the application of date / datetime functions.


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

Video: Converting Word Documents to PDF Format Using SharePoint Server 2010 and Word Services

Watch this visual how-to video as you learn how to programmatically convert Word documents to PDF format on the server by using Word Automation Services with SharePoint Server 2010. (Length: 6:15)

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.

How do I format a date time field in a CQWP to YY-MM-DD ?

Hi. I have been trying to get the date-time to look good for some time now, but have failed. I have a Content Query web part that picks up article pages from a page library. The pages contains a field called 'article date'. I want to show just the 'Title' and the 'Article date'. Doing this default gives me: My title 10-09-03 00:00:00 I want it to be: My title 10-09-03 Is this possible? I'm starting to realize that I probably have to edit the xsl styles for this webpart but if thats the answer, how do I do that? ThanksThomas Balkeståhl - Technical Specialist - SharePoint

Format Date in TextBoxFor

I've been trying to format the date in a view form in a textboxfor and it seems everything I try doesn't seem to work. I found this great partialview example but it doesn't work when applied to EditorFor. Again works great when using the DisplayFor HTML helper method but still spits out the time at the end when trying to format for a textbox.If anyone has any suggestions or answers I would be greatly appreciative.Jim

Remove Word Style once copy and paste content to Rich text Editor in sharepoint 2010

Hi Guys, I have page layout for Users to add content for Page.I have site column for page content on field type HTML with Richtextmode="FUll Html". Now when user cut and paste content from Word document in this Field it carry word document style. how can i control this content on Page layout with CSS. Please adviseThanks Ron

Date format for Year, Year-Month, and Date (Year-Month-Day) where input is not known

I have a requirement to capture historical events in a table. Now some events will have only Year, some Year/Month, and remaining where Date is known. We should be able to store them in the column and be able to sort etc. When publishing the information, we should be able to publish as was the input, Year only, Year-Month only, or Date. I looked at the newer Date data type. I can insert a 4 digit year, but on retrieving it is YYYY-01-01. I do not know if it has input YYYY or YYYY-MM-DD and is indeed a Date or a Year. I am trying to avoid saving the format information in another column or something. For sorting, when records have same Year, I would have another column to do relative sorting... So question is - what are my best options with SQL/Entity Framework combo. And what others have done, when encountering similar - if any. Thanks in advance. --Sharad 

how to change date format

Hi,   I am using Oracle 10g im my asp.net project. In my select query, i want to change the format to dd/mm/yyyy hh:mm:ss from mm/dd/yyy hh:mm:ss. The field datatype is date. How can i write a query for this?

Why can I not group by calculated field in Date format?

After migrating to SP2010 Foundation, I've discovered that for some reason I can't group a list by a calculated date field. Ex: Create a list with a date column A. Create another column B with a simple calculated date of [A]+1 and use the field format type 'date' Modify view to group the list by column B.  You're list will load, but when you attempt to expand one of the groups you'll be greated with an exception error. Why?? Am I doing something wrong? Note: You can group fine if the data type for column B is anything except 'date' format, but I really need to group items by a calulated date. Ultimately, what I'm trying to do is group my list items by week by calculating the end of the week using a simple formula =[Must ship by]+7-WEEKDAY([Must ship by])  then I want to gropu by the [Must Ship by] column like I always did in SP 2007, but now it errors out.  I also wanted to create my own timesheet template since the Fab 40 templates aren't available for 2010, but I can't really do that effectively without being able to group timesheet entries by week.  

How to get a date in ISO format in DataViewWebPart

Is it possible to get date in ISO format (2005-08-23T18:31:42Z) inside DataViewWebPart in SharePoint 2010? I am only able to get the date in my locale, which doesn't sort properly. In SharePoint 2007 there was no such problem, but in 2010 it is a very annoying one.

Word Document date property defaulting to an incorrect value.

Within a SharePoint document library we have a custom column that is a date (Inactive date). If you look at the properties from within SharePoint on a document the date is empty. If you open the document in Word 2007 and look at the properties the date has acquired a value, always the same value 30/11/1999. If you save the document and look at the properties in SharePoint again it now has the value.  Unfortunately in Business terms this now shows that the document is “In Active”. I traced the date back to the template document on the library. I edited the template document by removing the date and saving it. If I then create a new document and save it again the properties in SharePoint show an empty date. However if I then open the document again in Word the date appears. This problem does not occur with word 2003. How can I stop the date defaulting to this value when a document is opened in Word?

date format in excel using c#

i have a datagridview and one of the column is date with format dd/MM/yyyy HH:mm:ss but when i export to excel the date format become 'd/m/yy HH:mm' how can i format the column in excel with the date format 'dd/MM/yyyy HH:mm:ss' i am using below method Excel.ApplicationClass ExcelApp = new Excel.ApplicationClass(); Excel._Worksheet oSheet;  oSheet = (Excel._Worksheet)oWB.Worksheets[1];

Need to convert query string(date - 09/15/2010) to a text format - yyyymmdd

I am fairly new to C # and need some assistance with a form page.  I have created a simple form that requires the user to select a beginning date and ending date.  I then pass the values to my code behind page via query strings.  I have them passing, but I need the format to be change to a different format.  Unfortunately the database does not use the standard date format.  It requires the date to be in a text format as YYYYMMDD.Form: <tr> <td> Beginning Date:</td> <td><asp:TextBox runat="server" ID="begDate"></asp:TextBox> <asp:Image ID="Image2" ImageUrl="~/images/calendar_schedulehs.png" runat="server" /></td> </tr> Code Behind: protected void createReport_Click(object sender, EventArgs e) { StringBuilder url = new StringBuilder("Report/TopCustomer.aspx?"); url.Append("BegDate=" + begDate.Text); url.Append("&EndDate=" + endDate.Text); url.Append("&Brnch=" + ddlLocation.SelectedValue); Response.Redirect(url.ToString()); Current URL: TopCustomer.aspx?BegDate=09/15/2010&EndDate=09/30/2010&Brnch=300I need to have the above URL change to:TopCustomer.aspx?BegDate=20100915&E
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