datetime

Is there a JQuery plugin to convert UTC datetimes to local user timezone?

If I have a tag: <span class="utctime">2010-01-01 11:30 PM</span> I would like a jquery script or plug in to convert every utctime class to the current user's browser local time. I would prefer to find this before writing one. ...

Pick up date, add day and put back

I want to pick up date from screen, add 1 day and put back to screen. <input type='text'value='20101231' id='from_date'> <script> function date_move(direction){ var from_date = document.getElementById('from_date').value; var YYYY = from_date.substring(0,4); var MM = from_d...

Ruby date cutoff in Time.parse()

Ruby's Time.parse() works for dates from Dec 14 1901 up Jan 18 2038 (this appears to be system dependent): # works irb(main):038:0> Time.parse('14-12-1901') => Sat Dec 14 00:00:00 -0600 1901 # doesn't work irb(main):039:0> Time.parse('13-12-1901') ArgumentError: time out of range from /usr/lib/ruby/1.8/time.rb:184:in `local' f...

.Net DateTime fiscal Quarter

Does anyone know how to construct a DateTime in .NET to be the first day of the current quarter? ...

How do I OrderBy a DateTime difference in Linq?

I have a table with a CreatedDate column. I want to order by the rows that have been in the database the longest, but need to determine the number of days by subtracting it from DateTime.Now. I realise this is doable simply by ordering by the CreatedDate, but I need to do more than that. I need to order the items by the amount of times...

Date ranges: inclusive vs strict boundaries

When allowing a user to select a date range, let's say: Show me entries from [August 1] to [September 1] As a user, I would generally expect this to include the results for September 1. Especially when you consider that when I select the same date for both ends, I obviously mean "from start of day to end of day": Show me entri...

Automatically populate dates and times

What I am currently doing is setting up a calendar feature, but when the user selects the date, and then the TIME the event starts (ie startTime = 00:10:00am), that it will then pre-populate the second field (ie: endTime = 00:10:30am). So I thought maybe the best route would be when you select your time, jQuery would just select the NEX...

C# - Duration between two DateTimes in minutes.

Hi All, I need to determine duration between two DateTimes in minutes. However, there is a slight twist: exclude weekends only count minutes which are between 7:00AM and 7:00PM. for example: [09/30/2010 6:39:00 PM] - [09/30/2010 7:39:00 PM] = 21 Minutes I'm just having a hard time coming up with a decent way to do it and would ...

Date errors upon programatically inserting multiple nodes in Drupal

I am building a Drupal module that (among other things) creates multiple nodes of type 'individual_match' when a node of type 'team_match' is created. A team_match is a collection of related individual matches. I used the method explained on Advomatic, which I found in an old Stack Overflow post. It works great (meaning it creates the n...

String to Date parsing in C#?

Hi, I have a data string 'yyyymmddhhmmss' example: '20101001151014', how Do I parse this to date in C#? ...

Add a Specific Time to a Date Value

I have a stored procedure that receives a date value like this: @AsOf date In the query I am using this date to filter a datetime field. I need to convert the date passed in to a datetime field with the time portion set to 09:00:00 PM so I can add a filter in the WHERE clause like this: (DateCreated < @TimeAsOfNinePM) I know this i...

Selecting the latest values given data with missing records

... where "missing records" are identical to the last recorded value, hence no record. This may be subjective, but I'm hoping there's a standardised way of doing this. So, let's say I have a bunch of analytics in a MySQL table. There is some missing information, but as mentioned above, that's because their previous value is the same as...

Checking for invalid date in SQL Server Stored Procedure

I have a stored procedure in SQL Server 2008 that will insert a record into a table. The sproc looks similar to this: -- params @f1 int, @f2 datetime = null, @f3 datetime, @f4 bit = 0 BEGIN INSERT INTO dbo.table (fields......) VALUES (@params.....) RETURN @@IDENTITY END Prior to running the INSERT stateme...

Android java datetime values from String to Long to String issue

Long time reader, first time poster. In Android, capturing date from datepicker and storing as string in sqlite. Sorting by date doesn't work because they're strings (unless I'm doing it wrong. I've googled this issue for ~5 days, and it looks like there should be a way to capture the date from the date picker, convert it to a Long, s...

How to convert a UTC timestamp to local day, hour, minute in Java?

Given then timestamp 1245613885 that is a timestamp in GMT How do I turn that into Year, Day, Hour, Minute values in Java using the server's local timezone info? ...

Increating a datime field with queryset.update

My model looks like this class MyModel(models.Model): end_time = DateTimeField() and this is what I'm trying to achieve: m=MyModel.objects.get(pk=1) m.end_time += timedelta(seconds=34) m.save() but I want to do it with update() to avoid race conditions: MyModel.objects.filter(pk=1).update(end_time=F('end_time')+timedelta(secon...

Converting timestamp to datetime in MYSQL

Do you lose any data when converting a timestamp to datetime in mysql? Also what are the major differences between the two? ...

How to get hour from subtract date and time in mysql?

How to get hour from subtract date and time in mysql? 2010-12-04 17:07:14 and 2010-05-30 17:07:19 ...

Weird DateTime.Parse exception in 3.5?

This line of code works on my computer (64-bit Win7). I tested on XP 32bits in a VM. It works fine. static bool HasExpire { get { return DateTime.Now >= DateTime.Parse("10/20/2010"); } } However on a client machine it throws this exception: An unhandled exception was generated during the execution of the current web request. Inf...

How do I get a date or datetime out of an SQLite3 row?

There is no function as sqlite3_column_date which I need: int i = 0; for (NSString *key in [self valuesWithTypes]) { id value; if ([[[self valuesWithTypes] objectForKey:key] isKindOfClass:[NSString class]]) { value = [[NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, i)] autorelease]; } else if ([[[self v...