datetime

Ruby: how do I calculate a duration given 2 datetimes from a CSV file?

I have a number of CSV files which contain start and finish times. I can use FasterCSV to parse the files, but I don't know the best way to get the duration in Ruby. Here are the values in my hash generated for each row of the CSV files. start time: Mon Jul 20 18:25:17 -0400 2009 end time: Mon Jul 20 18:49:43 -0400 2009 ...

How do I improve the performance of code using DateTime.ToString?

In my binary to text decoding application (.NET 2.0) I found that the line: logEntryTime.ToString("dd.MM.yy HH:mm:ss:fff") takes 33% of total processing time. Does anyone have any ideas on how to make it faster? EDIT: This app is used to process some binary logs and it currently takes 15 hours to run. So 1/3 of this will be 5 hours. ...

Number of days in the current month using iPhone SDK?

A fairly straight forward question, I am trying to figure out how I can get the current number of days in the current month using NSDate or something similar in Cocoa touch. Thanks. ...

Database design -- NULL or a max value to indicate this date value?

SO I'm working on a schedule app that uses a MySQL DB. One of the modules for this site is for managers to track tardiness, overtime, and absents. The current site is a mess. It just has the manager enter in the key data, but it doesn't bind the manager to any of the already known data (like when the employee was expected to arrive/leave...

What to use as foriegn key if no match in the other table - MySQL

I am working on an attendance/overtime module for a schedule web app. The idea is that there is a table in MySQL of shifts, each shift having a start and end time. The manager will choose a shift and make an entry into the attendance table specifying whether the employee was early/late/left early/worked overtime. That entry in the attend...

Why isn't Django returning a datetime field from the database?

For my first Django app, I'm trying to write a simple quote collection site (think bash.org), with really simple functionality, just to get my feet wet. I'm using sqlite as my database, since it's the easiest to setup. Here's my only model right now: class Quote(models.Model): text = models.TextField(); upvotes = models.Intege...

Javascript converting DateTime to "______ seconds/minutes/hours/months ago"

The Twitter API returns time stamps of the form: "Sat, 25 Jul 2009 04:54:42 +0000" What's the best way to convert a time stamp of this form to "____ seconds/minutes/hours/months ago" depending on the time zone? Thanks ...

How to Send DateTime Or DbNull to DB using c#?

Hi all. I have a web form (.aspx) that has a textbox. My user can enter a value into the textbox as a persian date. what should I do is converting texbox.text into DateTime. But sometimes,the textbox has no text within it and so I should take care of it and return null. when I return null how can I insert null (c#) into DB? ...

Is there any difference between DateTime in c# and DateTime in SQL server?

hi Is there any difference between DateTime in c# and DateTime in SQL server? ...

SQL Server Datetime issues. American vs. British?

Hi Guys On my test DB, the dates are displayed in a DD/MM/YYYY format. By displayed I mean when you right click, open table in Management Studio, the returned data are displayed in a DD/MM/YYYY format. Funny thing is, when I write T-SQL to retrieve records, I have to input a MM/DD/YYYY format to get back the right data. Is there anyway...

MPMoviePlayerController movie length

Hi everyone, The question is - how to get the movie length from MPMoviePlayerController object? I need this to create a progress bar. I have the method [myPlayer currentTime] to move progress bar while movie is playing. And the [myPlayer setCurrentTime: doubleVal] to rewind the movie. But I can't use all this without information about ...

Get the date of next monday, tuesday, etc

I would like to find the date stamp of monday, tuesday, wednesday, etc. If that day hasn't come this week yet, I would like the date to be this week, else, next week. Thanks! ...

Format a string to display the Date correctly.

I need help converting this string --> 20090727 10:16:36:643 to --> 07/27/2009 10:16:36 The original date and time are being returned by the SynchronizationAgent.LastUpdated() function, which returns a String in the above format. Original question:preserved for reference I have this --> HUD.LastSyncDate = mergeSubscription.Synchro...

How to change the "date modified" of any file in Vista home premium?

Hello, In windows vista, how can i change the filed "date modified", of any file(text/binary) without editing it? I mean by just changing some of its properties. In Win-XP if one had to change date of any file(text, binary), in the file properties menu, one could add any string in one of the fields like Author, Comment, summary and sa...

How do you match 12 hour time hh:mm in a regex?

How could you match 12 hour time in a regex-- in other words match 12:30 but not 14:74? Thanks! ...

windows batch script format date and time

In a windows (XP) batch script I need to format the current date and time for later use in files names etc., Similar to http://stackoverflow.com/questions/864718/how-to-append-a-date-in-batch-files but with time in as well I have this so far: echo %DATE% echo %TIME% set datetimef=%date:~-4%_%date:~3,2%_%date:~0,2%__%time:~0,2%_%time:~...

Checking if Outlook ContactItem has Birthday data

Hi, I'm retrieving Outlook contacts and would like to find those that have a Birthday defined. When I read a contact that has no Birthday defined, the Birthday property of the ContactItem returns a date in the year 4501, using which I filter the contacts: if (contact.Birthday.Year != 4501) { ... the contact has a birthday defined, ...

What is a "DateTime?" as opposed to just a DateTime in C#?

What is the difference between a DateTime? and a DateTime (without a question mark) in C#? ...

How do I get last years date in C#

How do I get last years date in C# ...

How to Query an NTP Server from C#

All I need is a way to query an NTP Server from C# to get the Date Time of the NTP Server returned as either a string or as a DateTime. How is this possibly in its simplest form ...