datetime

LINQ to Entities for subtracting 2 dates

I am trying to determine the number of days between 2 dates using LINQ with Entity Framework. It is telling me that it does not recognize Subtract on the System.TimeSpan class Here is my where portion of the LINQ query. where ((DateTime.Now.Subtract(vid.CreatedDate).TotalDays < maxAgeInDays)) Here is the error I receive in the VS.NET ...

How to get a date from MySql database to C# DateTime object?

I have a MySql database with a certain feild that contains a date. How can I convert it to a C# DateTime object? And how do I convert a C# DateTime object so I can insert it to the database? ...

Recommend a JS calendar widget that handles both date and time?

I'm working on a Web app where users need to input a date and time. I've used this calendar widget before and it works fine: http://www.dynarch.com/projects/calendar/ However, it hasn't been updated since 2005. I'm wondering if anyone knows of a better one. The calendar in jQuery UI doesn't handle times. Only dates. I need something t...

Get timezone from DateTime

Does the .Net DateTime contain information about time zone where it was created? I have a library parsing DateTime from a format that has "+zz" at the end, and while it parses correctly and adjusts a local time, I need to get what the specific time zone was from the DateTime object. Is this possible at all? All I can see is DateTime....

datetimepicker in vb.net

i am using the following statement: dim d as date d=format(datetimepicker1.value.date,"dd/MM/yyyy") but when the application is executed,following error is returned: not a valid month.. why is it so?? please help.. ...

Webservices for Time display in ASP.net

I need to display the time information (IST,GMT,EST) times in my ASP.net web application. Is there any webervices providing these datas. It should be free. ...

Getting an event from a database a week in advancee

I am currently developing a sports website where one of the pages with be forthcoming fixtures in which the user will be able to what team and where the team are playing their next match. I have a database with the following fields... ID TEAM NUMBER OPPOSITION VENUE DATE MEET TIME MATCH TYPE So a row of data pulled from the DB an...

MSSQL record date/time auto delete

I want to delete records from a db table based on a time-stamp for each record. I would like to have it automatically delete records compared to a date/time interval without user intervention or admin intervention. What would be the best way to go about this, I could create a process that runs in the background that does checks but that ...

Time comparison trouble with Rails

I have a very simple task at hand. If the last time a record was updated has been longer than 15 minutes, display a button. Otherwise, don't display the button. The field is a datetime. My view code: <% if @object.display_button? -%> my button <% end -%> My display button method on that object: def display_button? return fals...

Struts2 time (HH:mm) mapping to action field

I have a simple struts2 from: <s:form ...> <s:textfield name="initialTime" maxlength="5" size="5" /> </s:form> Where the user has to enter a time in HH:mm format. In the corresponding Action, I have a property: private Date initialTime; along with its getter/setter. I am getting a validation problem, as the received initialTime (...

Casting DateTime to OracleTimeStampTZ

Shortly before saving a DateTime to the datebase I'm casting a DateTime into an OracleTimeStampTZ. This converts the DateTime into an OracleTimeStampTZ in the current timezone, which is cool, that's what I want. Except the timezone is represented as a time off set (+13, since I'm in NZ). Now I'm a little afraid that this is going to bit...

Mercurial: how do I change commit time (not pushed yet)?

How can I change the time I've made a commit in my local repository? Suppose I've done several commits and noticed that the date on my computer is wrong. These commits were not pushed anywhere yet, so I want to fix the time. ...

Calculating different tariff-periods for a call in SQL Server

For a call-rating system, I'm trying to split a telephone call duration into sub-durations for different tariff-periods. The calls are stored in a SQL Server database and have a starttime and total duration. Rates are different for night (0000 - 0800), peak (0800 - 1900) and offpeak (1900-235959) periods. For example: A call starts at ...

ASP.NET - Getting a list of dates between X and Y and databinding them to a DropDownList?

Hi Everyone, I am hoping that this is possible and easy! As the title says, I want to specify two dates and get a data set of dates by specifying the start and end date, then be able to bind that to a DropDownList control on my page.. If it isn't possible (which is a damn shame) does anyone have recommendations or best practices for d...

DateTime Hex Format

I'm getting a hex string when converting a SPListItem's date. eg. "0x01c9d2be|0x809a8800" This question answers it. However, what's the proper way to convert it, what format is the DateTime object in? What if I want to set the datetime? Would I have to convert it into hex format and assign it as a hex string? There has to be a bette...

Oracle TIMESTAMP WITH TIMEZONE named zone vs offset

In oracle, is the named timezone always stored? I have been testing this column within our system, and in some places the timestamp is shown as: 26-FEB-09 11.36.25.390713 AM +13:00 but other times it's: 26-FEB-09 11.36.25.390713 AM Pacific/Auckland If the value is being stored as the former, does that mean the actual timezone is n...

Get UTC date out of SQL Server & show in grid as local time

I've got a table in SQL Server 2005 that has a datetime column holding dates in UTC form. I want clients to call the a .NET server app and the server will return a DataTable with records to be bound client side to a DataGridView. ** On the client the dates should be displayed in local time **, clients will be in may regions of the world....

Convert varchar in format mon-yy to datetime in SQL server

Is there a simple way to convert a date stored in a varchar in the format mon-yy (e.g. "Feb-09") to a datetime which will convert any invalid values to null. I'm currently using string manipulation combined with a case statement but it's rather cumbersome. ...

Get the previous month's first and last day dates in c#

I can't think of an easy one or two liner that would get the previous months first day and last day. I am LINQ-ifying a survey web app, and they squeezed a new requirement in. The survey must include all of the service requests for the previous month. So if it is April 15th, I need all of Marches request ids. var RequestIds = (from r...

How can I check if the current time is between in a time frame?

I have a service that user can configure to run during "off-peak" hours. They have the ability to set the time frame that the service can run. For Example: User A works 8am-5pm, so they want to schedule the app to run between 5:30pm and 7:30am. User B works 9pm-6am, so they schedule the app to run between 6:30am and 8:30 pm. The poi...