.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

CalendarExtender wrong date from database

Posted By:      Posted Date: August 26, 2010    Points: 0   Category :ASP.Net


I'm about to go NUTS :)

I have 2 CalendarExtenders on page. And I want to show the date that I get from SQL SEVER:

select -> SELECT convert(datetime,  begin) as Begin, convert(datetime, end) as End FROM Table

The date field, on base,  is a char(8)  and the record is like YYYYMMDD. That's why I convert it to datetime.

But, on code behind when I do this :

CalendarExtender1.SelectedDate = DateTime.Parse(objDataEvento.Rows(0)(2))
CalendarExtender2.SelectedDate = DateTime.Parse(objDataEvento.Rows(0)(3)) 

Depend of the date, It's showing minus 1 day on page.

Like: If, on base, the date is 08/12/2010, on page it's showing 07/12/2010.

WHYYYYYYYYYYYY ??????????????? Cry Smile




View Complete Post

More Related Resource Links

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'))"

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 ?

Getting "wrong" data out of a microsoft.sqlserver.management.smo.database object property (using pow

My problem:I do something like this:$dbsvr = new-object microsoft.sqlserver.management.smo.server "servername"$dbsvr.databases | ft name,size -autosizeWhen i run this from two different PC's i get database sizes that are all the same (5.25 mb), the size of the first database listed - which is master.I started to try out a few things, and found out that when i run the same command from one of our servers it returns the correct sizes...Anyone have any idea if this a SMO issue, or maybe some package software version issue...- or what?

AjaxControlToolkit.CalendarExtender - highlight current date

I have used AjaxControlToolkit.CalendarExtender for calendar in my project.but anyhow I am unable to highlight current date  in calendar control.(Note: Current date I mean is today's date and not the selected date.)e.g.( If today is 15th August 2010, and I have selected 24 August 2010. then when I press calendar icon, I should see 15 august highlighted with different look or same as selected date 24 highlighted in August month of 2010 page in calendar popup.)Please guide me to accomplish the taskThanks in advance for support.

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>

SharePoint Search returns wrong date

Hi i am running a Sharepoint 2010 enterprise search indexing a file folder structure with emails(.eml) and attachments(.doc(x), pdf, xls(x), ...). The search results shows a date like first full index time or something like that, but not the date of file creation or any other attributes of the file. My questions: - what may be the reason of the wrong date? - is there a possibility use another attribute for displaying that is more relevante? Please help Kind regards Werner Durrer    

Sharepoint date calculations = WRONG

Can someone show me how to create a calculated column that displays the date only? I'm using the microsoft absence planner. I am simply trying to display a date without the time. I'm getting inconsistent results. Someone suggested that I simply add a day but that is not consistent. I created a calcualted column to show me the day that Sharepoint thinks the time value has. The results are disappointing to say the least someone suggested this formula since it seems to be always off by a day: StartDate is a calculated column = =DATE(YEAR([Start Time]),MONTH([Start Time]),DAY([Start Time]+1)) *sometimes this formula displays the right info, sometimes not The last column is just = Day_[Start Time] so I can try and figure out what is going on :( Attendance item      System Account      Other      6/28/2010 12:00 AM      6/29/2010      28 Attendance item      System Account      Jury Duty      9/29/2009 12:00 AM      9/30/2009      29 Attendance item      System Account      Jury Duty      9/29/2009 12:00 AM      9/30/2009 &nbs

convert date to mmddyy format before submit to database

Dear all,   Could anyone pls guide me on how to convert date in textbox which is in format(dd/mm/yy) to mmddyy before submit to database.    

after restoring content database getting error (HTTP/1.1 200 OK Server: Microsoft-IIS/7.5 Date: Tue,

Hi All, Problem i have taken backup of Old site content database procedure see below 1) first i changed the database to read only mode (Opened SQL Server2005-->selected DB--> properties--> Option-->Database Read-Only=True) 2) taken backup of database from the task--Backup(new.bak) 3) Copied the taken backup to new server and restored (Opened SQL Server2005 --> Right Click on Database Folder--> Restore Dataase) In To database: ihave given DB name From Device: i have selected database from the location where i have saved. click ok.  It has restored successfully 4) I have created a new webapplication and removed its content database from central admin. 5) with the help of stsadm command i restored the above db to this webapplication. then iam getting below error: HTTP/1.1 404 Connection: close Date: Tue, 14 Sep 2010 06:20:08 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET MicrosoftSharePointTeamServices: i have refered the below url for restoring http://metahat.blogspot.com/2008/11/backup-restoring-sharepoint-2007-site.html Please help. Thanks in advance.

about date in database question

hi i need to find data between 2 date's and time's. i use one field for date ,  and one field for time. **is it be better to use only one field for date & time ?** i see that it came in  `dd/mm/yyyy hh:mm:ss`  format that  can contain date and time. this question is for acceess and for sql-server thank's in advance

i get date in wrong format - need help


i get date from xml in this format:  `7/16/2010 (mm/dd/yyyy)`

i have in my program  `datetime val -  MyDate`.

and when i try to placing   `MyDate = Convert.ToDateTime(7/16/2010)` 

i got error.

how i can fix it ?

thank's in advance

Date from a database using code behind



I'm trying to rework some code I've found, and it's all now working except for the date (dbDate). I need to keep it as a date value (and not convert to string), but I can't get the code to work:

        using (conn)
                comm.Connection = conn;

Last Modified date of the database



How to find the Last modified date of the whole database (Not the specific table)? Is there any function available? I checked the last modified date of the mdf file and that does not give the correct information :(

Dreaming a world without any war in anywhere

how to save and retrive date in database using jquery ajex asp.net ,JSOn,XML,HTML


how to save and retrive  date in database using  jquery ajex asp.net ,JSOn,XML

SQL 2008 master database has wrong collation


I'm pretty new to SQL, so excuse me for landing in this situation in the first place.  Never again!

I had an old Windows 2003/SQL 2000 server which I wanted to retire, so installed a nice new Windows 2008 R2/SQL 2008 server to host all the databases.  I detached all the databases, copied them over, and attached them to the new server.  Everything appeared to be running OK.  However, the application is now complaining that I have different collations between the master database, and all the other ones.  the master (and other system databases) is Latin1_General_CI_AS and all the user ones are SQL_Latin1_General_CP1_CI_AS.

What I need to do is change the master to SQL_Latin1_General_CP1_CI_AS and ensure that any new databases which the application creates in future are also SQL_Latin1_General_CP1_CI_AS.  I have no idea how to do this!

I suppose one option wiould be to reinstall and start again, but I'm sure there must be an easier way.  Musn't there?  Help!



ajaxtoolkit:CalendarExtender disable the dates which are lessthan current date


 hi frds

i'm using ajaxtoolkit:calenderextender

in this i should not be able to select dates which are lessthan currentdate

is this possible?

how to solve this ?

thank u in advance



CalendarExtender date checker


I have read many forums to see if I could find a solution and there hasn't been anything that is what I need.  I have an asp:calendar that you select a date on there and a panel pops up.  On the panel, the start date and end date are filled with the selected date from the asp:calendar.  The end date field has the CalendarExtender.  When you open it, the selected date on there is the same as from the asp:calendar which is good.  What I need is to tweak my javascript to check to make sure that the user picks a date after the selected date from the asp:calendar.  so if they pick 11/4/2010 as a start date, the end date cannot be fore 11/4/2010.  Only anything after that.  Not todays date(ex. 10/22/2010).

codebehind for my asp:calendar sending the dates

        'post date in panel
        If e.Day.IsSelected Then
            txtSDate.Text = e.Day.Date
            txtEndDate.Text = e.Day.Date
        End If
JavaScript and asp code
        <script type="text/javascript">
            function checkDate(sender, args) {
                if (sender._selectedDate < new Date()) {
                    alert("You cannot select a day earlier than today!&q
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