.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

Formatting Date consisting of several Fields but no value for the day

Posted By:      Posted Date: September 21, 2010    Points: 0   Category :Sql Server


     I´m working on some reports with SSRS 2008 and I need to display a date in the format dd.mm.yyyy. Normally that would be easy but the Problem is, that the Date I need to display doesn´t exist as a Field. I have a Field containing the month and another Field containing the year but no field containing the day. Furthermore the day should be always the last day of the month. Does anybody know how to solve this date-puzzle?


Your help would be much appreciated.


View Complete Post

More Related Resource Links

date formatting


I have a 3 field table in sql server express and one of the columns is a date.

I'm trying to pull that in and publish to a gridview, but when I do it comes in with the date and minutes and seconds, etc.

How can I format that so that I only publish MM/DD/YYYY?

thanks in advance 

Calculated Date Fields

I'm trying to calculate whether a delivery is on time or late and by how many days. Is there a way to format the column so it show's the result in the number format as opposed to showing up as a date? Negative numbers don't export into excel well.

How to handle *many* date fields?

I have put together a cube for auto loan analysis. It is populated via monthly snapshots. There are many actions taken on these loans that have a date stamp associated with them (repossess/resell/refinance, etc.). These fields are on each row and only populated if utilized, else NULL. In the design of the cube, all of these fields were specified as being associated with date dimensions. Now that I am actually building this thing out, my date dimension is aliased (role playing) 15 times! This seems ridiculous to me as many of these date fields are not useful for analysis, per se. Primarily the analysts need the ability to filter based off of them. Ie. Display measures [x],[x1] in a pivot table where reposession date > '[Jan 2005], etc. They use excel 2007 for analysis. Is there another way to handle all of these auxiliary/sparsely populated dates besides creating dimensions for them?   Thanks for your help!

Change database fields automatically according to date

Hi, I'm currently developing a software application for my client. Part of the project is to keep track of his stock's shipping status. The client must insert the stock's pick-up date, expected time of departure (ETD) and expected time of arrival (ETA). The stocks will be called out using Grid View and the status, being one of the keys of the database, will be shown. Before the current date reaches pick-up date, the status must show "in warehouse", and after the current date reaches pick-up date and is before ETD, status must show that its "on the way to the port", and after ETD and before ETA, "in freight", and finally after ETA, "arrived". What datatype should I use for the database and where should I program it so that it changes automatically accordingly ?

Updating a List item field value in a SPD Workflow is setting Date fields to null

Hello everybody,I faced a very weird behavior while creating a workflow in SPD against a Document Library.Here is the case:1- Create a document library in sharepoint site.2- Add a custom column of type DATE.3- Upload any document to the library4- Edit the item metadata and set the custom date field to any date you want.5- Now using sharepoint designer, create a very simple Workflow with only one action that updates the current item "Title" field to any value. (Note: In my case I set the workflow to start manually and not automatically)6- Save the workflow and then start it on the uploaded item.7- Now check the value of the date column after the workflow is finished.8- You will see that the Date field is Empty... (very weird)Notes:   1-This behavior will not appear on a standard list. it is only appearing in a Document library.  2- I am using WSS 3.0 SP2 + MOSS 2007 SP2. Also SharePoint designer 2007 SP2Did anyone face this situation and does it have a fix, or am I doing something wrong here... Please help.Regards,Maheed

Is it possible to use multiple date fields to have an event show more than once on a Sharepoint 2007

Hello, Is it possible to use multiple sets of start and end times to have events display multiple times in a sharepoint calendar? To clarify: - I have the standard fields of "Start Time" and "End Time" in my calendar list. - Events show on the calendar just fine. - Would like to create additional fields called "Start Time 2" and "End Time 2" within the same record and have the event show multiple times on the calendar. - The recurrence functionality of sharepoint will not meet my needs because the pattern I need to use is not in one of the allowed choices. Thanks in advance, John

Formatting the date with the CalendarExtender

I must be missing something here.  I use the code below to display a DateTime value, and the time is always displaying, i.e. 7/11/2010 08:10:10. I just want the date.  The Format value doesn't seem to have any effect.    <asp:TemplateField HeaderText="Exp Date" HeaderStyle-Width="100px">   <ItemTemplate>   <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("expirationDate") %>'></asp:TextBox>   <cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="TextBox1" Format="MM/dd/yy" />   </ItemTemplate>   </asp:TemplateField>

Date Validation and Date Formatting

 Hi,   I am new to ASP.NET 4.0 and the whole Object Oriented Programming.  I added a Calendar Extender on a text box.  Now I would like it to be formatted to MM/DD/YY, PLUS, I also want to validate if the date entered is more than let's say 90 days from today.  If it is more than 90 days, I would like to show something like an error message and set the focus on the date field.  I am writting my code in C#.  Can any body help on this?  Thank you. esant    

Date Time Formatting to a specific dateformat

Hello All,I have been struggling with this for a long time. I have a form in which there is a textbox using an ajax calender extender. Now, the problem is that, I want to take the Date value which is string format and format it to a specific date format before inserting it into the database. The following is the core problem:Dim MDate as string=txtMeetingDate.Textdim d as new Datetime' I want to convert the d to a datetime using the Mdate/// The problem is that I don't know what's the date format in the TextBox because users can use any time format they want, it is based on their windows settings!!!So, I am struggling to change my String (MDate) into a DateTime in the same format the user have and then convert it into my format:"dd/MM/yyyy" and after I have the date in the correct format, I want to change it back to string and save it in the database.I am doing this so that I have the same dateformat saved in my database.Any Ideas? ThanksAMB

XPath Date Formatting Problem


Hey all, just plain and simple I think....lol

Why will this not work?

<asp:Label ID='playDate' runat='server' Text='<%# XPath("LastPlayed", "{0:MMM d yyyy}") %>'></asp:Label>

It completely ignors my date formating and returns this result.


Oh yea, this is in a datalist using an XML datasource.

Date formatting problem with BIDS


I've just moved to a new PC, and had BIDS installed on it.  All machine dates are set to the international standard (dd/MM/yyyy).

I just opened an existing report to modify it that includes a date range in the parameters.  When I tried to do a test preview of the report in BIDS, I got an invalid data error on the first date parameter.  After a bit of fiddling around, I worked out that it would only let me input the dates in US format, yet after input the dates are converted to international format.  When deployed to the report server, the report requires the dates to be input in international format.

I've spent half an hour checking my machine and BIDS to try and find the cause of this problem, and I'm stumped.

Any suggestions?

Date formatting in SPGridview


How can I format the date from 9/23/2010 12:00:00 AM to 9/23/2010 in an SPGridview?

Thanks, Ninel

Sharepoint designer 2007 - Java date query - and how to disable value required for hidden fields


Hi guys,

created a list, i've managed to get field to hide and dates to populate into the applicable fields, I just have 2 queries taht I need some help with

>I need to work out how to get var tmoz to ignore saturdays and sundays - i.e. if request is raised on fri - it would default to the following mondays

>I need to work out how to mark a field as no input required if it is hidden, and input required if visible (urgent change justifacation)

 Below is the current java i'm using

<script type="text/javascript">
  function hideFieldsOnStart()
   //hide the control at start
   var control = getTagFromIdentifierAndTitle("input","TextField","Urgent Change Justifacation");
   var control2 = getTagFromIdentifierAndTitle("input","DateTimeFieldDate","Proposed Implementation Date");
   //add an onchange event to the dropdown
   getTagFromIdentifierAndTitle("select","DropDownChoice","Change Type").onchange = function() {ChangeEvent()};

Report Builder returning #Error value in empty fields and working with Date field


Hey guys,

I am trying to build a report using the date field from CRM and only wanting to return the date I am using this expression "=Fields!new_date.Value.ToShortDateString()" but when there is an empty fiel I get #Error. How do I solve this?

Also is there anyway to return the date field with the actual month showing instead of the numerical value? i.e. instead of 1/31/2010 Have it show January 31, 2010 (Doesn't have to be exactly in that format, but want the name value for the month.)

SPGridView date formatting



I am using SPGridView in SP2010. I am attaching a datatable to this SPGridView which has a date column in it. But, I dont want to show the timestamp which is comming alongwith the date.

There is no dataFormatString property supported for the SPGridView. How do I achieve the same..?

Thanks in advance..


listview date formatting


i have a listview thats tied to an access database. and at the moment it displays the date like this:

27/10/2010 12:00AM

but i want it to display in long date format like this:

wednesday, 27, october, 2010

how would i achieve this?

thanks for your help in advance!! :)

simple answers with code sample would be appreciated...im only new at this


INFOPATH: how can I calculate hours between 2 date fields in a list form


I am trying to calculate the number of hours between 2 date/time fields in a list form.

If I do this on a list view level with a calculated column, the column is not available for column summaries. Therefor I intend to use a regular number column and calculate the hours in an InfoPath form. Obviously the formula for calculated fields in list columns will not work in InfoPath.

Addition: I tried DateField1-DateField2, but the result is NaN...



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