datetime

DateTime DayOfWeek Comparison

Id like to Compare a date to see if it is before Saturday like so: //Check if Saturday YET if (MYWorkDay.DayOfWeek < DateTime.DayOfWeek.Saturday) IGottaWork(); else Party(); There seems to be no way to do this. Is there a way? Thanks in advance ...

python how to -generate license- using time module

hello . I'm searching for a way to generate a (limited time license) .so when a user starts the program . it has to check license date first before the program runs. but the problem is : i tried a couple of solutions . one of them is python's time.ctime , (to check time and see if it's realy during the license time) and it returns the ti...

How can I keep original file timestamp on subversion?

I want to be sure that if I commit something in subversion from one machine and I checkout on another I will get the same value for datetime/timestamp. Currently I observed that the file datetime is from the comment when I did the sync instead of the original value. For me it doesn't make any sense to know when the files were synced - ...

Why is DateTime.now returning 'invalid date' ?

In a haml partial I have: =@date = DateTime.now and it's returning' invalid date': /usr/local/lib/ruby/1.9.1/date.rb:809:in civil' /usr/local/lib/ruby/1.9.1/Date.rb:1810:innow' Any ideas why? ...

TimeZoneInfo.ConvertTime equivalent for .NET 2.0?

I need to update a .NET 2.0 website to include a function to convert time from a time zone to another. Unfortunately I cannot use TimeZoneInfo.ConvertTime in .NET 2.0. Is there any equivalent or workaround that takes into account Daylight Savings time? Thanks in advance ...

Restrict SQL results by time, MySQL

Hey, I have a table containing events which happen in my application like people logging in and people changing settings. They have a date/time against the event in the following format: 2010-01-29 10:27:29 Is it possible to use SQL to select the events that have only happened in the last 5 mins? So if the date/time was 2010-01-29 ...

Is there any difference between DATE_SUB() and using arithmetic operators for datetime calculation?

After I have seen a lot of questions here using the DATE_SUB() or DATE_ADD() functions instead of the arithmetic operators + or -, I was wondering if there was any difference: Quote from the MySQL-manual: Date arithmetic also can be performed using INTERVAL together with the + or - operator: date + INTERVAL expr unit date - INTER...

display time in a web page

Hello, I have page where where I list all comments for a post. Next to each comment I have a time value in full format including the date/time (2010-01-02 11:11:20). I know that I can format it in PHP before displaying it, so it shows; posted 40 secs ago posted 5 days ago but that would not be efficient as I am going to cache the...

SQL Query for lowest time rows

I have a table with one DateTime column. I want to find the rows with lowest time which their times are more than a variable myTime. How can I do that? What kind of index will increase the performance? ...

date and time control format

I have used Ajax calender extender to display date in Date_Box and then numeric up down extenders to chose time... Here is my code: <td bgcolor="#969ECD"> &nbsp;&nbsp;&nbsp; <asp:TextBox ID="Date_Box" runat="server" Width="85px"></asp:TextBox>&nbsp; <br /> <div style="height: 4px"></div...

How to calculate elapsed time from now with Joda Time?

I need to calculate the time elapsed from one specific date till now and display it with the same format as StackOverflow questions, i.e.: 15s ago 2min ago 2hours ago 2days ago 25th Dec 08 Do you know how to achieve it with the Java Joda Time library? Is there a helper method out there that already implements it, or should I write the...

Transact-SQL: Detect Date boundaries across multiple rows.

I am creating a stored procedure that produces reports based on data in a SQL database and stores these reports in a separate database. The data being reported is the total time over a date range that a motor was running. I want to be able to detect if the timeframe I am reporting overlaps previous reports based on date times. For ins...

PHP parsing a date using strptime() or strtotime()

HI, I have a problem parsing a date in php using strptime() as my system is running windows. I've also try to parse the date using strtotime() but not luck either because I'm using euro date format. This is the date format I'm using 30/11/2009 11:00 am and I need to get the timestamp from it. Any ideas how can I achieve this ?? ...

How do I get a timestamp from an NSString date?

I have an NSString date (@"Mon, 01 Feb 2010 20:25:37 +0000") that I want to change into a timestamp so that I can better calculate how much time has elapsed from the current time. How can I change the NSString date into a timestamp value? ...

DateTime.Now.ToShortDateString(); replace month and day

I need to change format of this.TextBox3.Text = DateTime.Now.ToShortDateString(); so it returns (for example) 25.02.2012 I need 02.25.2012 how to realize it ?.. ...

Is there a safe check I can do before calling DateTime.AddMonths(int months) ?

If I call AddMonths on a DateTime object using an int that is too large, I get an ArgumentException thrown in my face with a polite message that says, "The added or subtracted value results in an un-representable DateTime. Parameter name: months" What check should I do on the months argument before calling this method? ...

DateTime.ToString() display meridiem as "A.M." or "P.M."

Is there any way to use the DateTime.ToString() method to display the meridiem of the time portion as "A.M." instead of "AM"? I tried using the mask "t.t." but this just outputs "A.A." ...

datetime picker for ASP.NET 3.5 webforms

Is there a free for commercial use date and time picker in ASP.NET webforms? Right now I am using the AJAX calender extender with Visual studio 2008, but have nothing for time picker. I want a control that is free and has no license to it. I know that there are JavaScript controls but was wanting to stick with ASP.NET webforms controls...

Convert String to Date in .NET

What is the best way to convert string to date in C# if my incoming date format is in YYYYMMDD Ex: 20001106 ...

Java type for date/time when using Oracle Date with Hibernate

We have a Oracle Date column. At first in our Java/Hibernate class we were using java.sql.Date. This worked but it didn't seem to store any time information in the database when we save so I changed the Java data type to Timestamp. Now we get this error: springframework.beans.factory.BeanCreationException: Error creating bean wi...