datetime

smoothing irregularly sampled time data

Given a table where the first column is seconds past a certain reference point and the second one is an arbitrary measurement: 6 0.738158581 21 0.801697222 39 1.797224596 49 2.77920469 54 2.839757536 79 3.832232283 91 4.676794376 97 5.18244704 100 5.521878863 118 6.316630137 131 6.778507504 147 7.020395216 157 7.331607129 176 7.63749222...

Error inserting data using SqlBulkCopy

I'm trying to batch insert data into SQL 2008 using SqlBulkCopy. Here is my table: IF OBJECT_ID(N'statement', N'U') IS NOT NULL DROP TABLE [statement] GO CREATE TABLE [statement]( [ID] INT IDENTITY(1, 1) NOT NULL, [date] DATE NOT NULL DEFAULT GETDATE(), [amount] DECIMAL(14,2) NOT NULL, CONSTRAINT [PK_statement] PRIMARY KEY CLUSTE...

what is the difference betwen timestamp in java and php?

Hello, I have a java file that write records to the DB and time stamps I have another php file that reads that records.. unfortunately After converting the time stamp to dates I got a wrong dates ?? what is the problem !!! ...

Weird created_at behavior

I've set config.time_zone = 'UTC' in environment.rb, and yet still I get some weird behavior with Rails' built-in datetime fields: >> Time.now => Sun Jun 21 17:05:59 -0700 2009 >> Feedback.create(:body => "testing") => #<Feedback id: 23, body: "testing", email_address: nil, name: nil, created_at: "2009-06-22 00:06:09", updated_at: "2009...

Rules for "Date Modified" of folders in Windows Explorer

How does Windows Explorer determine the "Date Modified" field for folders? [Aside: I know this is asking from an explorer-specific perspective, but the behaviour could be useful to coding search/sort type activities] Is there a definitive description of this anywhere - searches of Microsoft, MSDN, Google & Stack Overflow have been unsuc...

How do I add times in C#?

How do I add times in C#? For example: Time = "14:20 pm" + "00:30 pm" ...

Get distance between one date and another in SQL (ISO format)

Let's say I have a table with two columns, where a user places a booking. datefrom dateto ------------------------------------------- 2009-05-23 00:00:00 2009-05-27 00:00:00 How would I use SQL to return how many days the user will be booking for? All I want is to return the number of days. ...

SQL date type range not according to spec?

According to MSDN the range for date datatype is January 1, 1753, through December 31, 9999 In SQL2005 the following is interesting: declare @date as datetime SET @date = '1/1/1901 12:00:00 AM' SELECT @date if (isnull(@date,0) = 0) SELECT 'date is null' ELSE SELECT 'date not null' change the date to '1/1/1901 12:00:00 AM' and sudden...

Change ASP.NET default Culture for date formatting

For some reason, ASP.NET code on my server is now returning a format of dd/MM/yyyy instead of MM/dd/yyyy when I use DateTime.ToString("g"). Rather than replacing all the "g" format strings with a concrete format string or CultureInfo argument, is there a way I can just override, across the application, the default "short date" format? ...

Get first date of week from provided date

I want to pass a date object into a function and determine what the first date of that week was. Example: If I pass in today's date (2009/06/24) I want the function to return what the first date of this week was, i.e. Sunday's date was 2009/06/21 so it must return that. Anyone know of any standard javascript function that does that? Th...

Django unit testing with date/time-based objects

Suppose I have the following Event model: from django.db import models import datetime class Event(models.Model): date_start = models.DateField() date_end = models.DateField() def is_over(self): return datetime.date.today() > self.date_end I want to test Event.is_over() by creating an Event that ends in the futur...

Date format problem using SSIS for Excel into SQL Server

Hi, I am trying to import a column of dates from a spreadsheet in Excel 2003 into SQL Server 2005 using SSIS. I am in the UK so want dates formatted as dd/MM/yyyy. Unfortunately, the column in the spreadsheet contains a mixture of dates stored as strings in dd/MM/yyyy (with Excel 'General' formatting) as well as dates using Excel 'Dat...

IncHour procedure in DateUtils

I have the following bit of Delphi 7 code to increment a TDateTime value by one hour. For some reason it doesn't work. StatusMemo.Lines.Add('prior '+DateTimeToStr(dtval)); IncHour(dtval,1); // add an hour for DST StatusMemo.Lines.Add('after '+DateTimeToStr(dtval)); Contents of StatusMemo after code runs: prior 6/24/2009 5:35:40 A...

Passing datetime to a stored procedure & add a 1 sec to datetime

There are two things here i want to accomplish. List I want to pass a datetime into my stored procedure in the following format ('2007-05-28 00:00:00'), but that doesn't seem to work unless i use {ts '2007-05-28 00:00:00'} The next thing is I want to increase the @SEAL_DATE by a second so it can be used to check the dates between the e...

DateTimeOffset.Now in T-SQL

I'm executing a INSERT to a sql 2008 db. How do I specify in T-SQL to insert NOW in a DATETIMEOFFSET column? GETDATE()? ...

WPF GridView: Changing the DateTime formatting for bound DataTable

We're using a WPF GridView that is dynamically bound to a DataTable (which in turn is the direct result of a DB query). This basically works fine and displays whatever the results from the DB query are in a nice table. Now the problem is that some of the results contain DateTime columns, and the date displayed is always in US format and...

Remove day name from DateTimePicker

I have a DateTimePicker and it is currently displaying "Friday, June 26 2009" How would I change it so it displays "June 26 2009"? ...

Preferred method for handling Y2K date conversions?

Is there a preferred algorithm for converting a 2-digit year into a 4-digit year? I have a 2-digit birth date (along with month and day) that I want to convert to a C# DateTime. Obiviously, birthdates cannot be in the future, but is there an existing facility in .NET to convert a 2-digit year into a four-digit year? ...

DateTime issue on different platforms (.NET 2.0)

On a 32 bit OS, with an Intel processor, DateTime e.g. 2/17/2009 12:00:00 AM Notice that it is: mm/DD//yyyy On a 64 bit OS, with an AMD processor, DateTime e.g. 17-02-2009 00:00:00 Now when I try to parse the 1st format, it throws an error on the 2nd platform. That means - DateTime.Parse("2/17/2009 12:00:00 AM") - throws an error - can...

How to add hours to Javascript Date object?

It amazes me that Javascript's Date object does not implement an add function of any kind. I simply want a function that can do this: var now = Date.now(); var fourHoursLater = now.addHours(4); function Date.prototype.addHours(h) { // how do I implement this? } I would simply like some pointers in a direction. Do I need to ...