date-manipulation

Why does Date::Calc complain about "not a valid date"?

Previously, this function worked for me... $this_day = Day_of_Week($lyear, $month, $day); using this lib.. use Date::Calc qw(Add_Delta_Days Day_of_Week Delta_Days); But I need another way to get this same info. the error it returned is Date::Calc::Day_of_Week(): not a valid date Any ideas? ...

Simplest way to increment a date in PHP?

Say I have a string coming in, "2007-02-28", what's the simplest code I could write to turn that into "2007-03-01"? Right now I'm just using strtotime(), then adding 24*60*60, then using date(), but just wondering if there is a cleaner, simpler, or more clever way of doing it. ...

How to add 30 minutes to a javascript Date object?

I'd like to get a Date object which is 30 minutes later to another Date object. How to achieve it? Basically: Tue Jul 28 16:00:00 UTC+0800 2009 add 30 min to Tue Jul 28 16:30:00 UTC+0800 2009 Tue Jul 28 16:40:00 UTC+0800 2009 add 30 min to Tue Jul 28 17:10:00 UTC+0800 2009 ...

Why do I get “uninitialized value” warnings when I use Date::Manip’s UnixDate in a sort block?

Related/possible duplicate: http://stackoverflow.com/questions/1263943/why-do-i-get-uninitialized-value-warnings-when-i-use-datemanips-sortbylength This block of code: my @sorted_models = sort { UnixDate($a->{'year'}, "%o") <=> UnixDate($b->{'year'}, "%o") } values %{$args{car_models}}; kept generating the following err...

Grouping dates by month in an sql server query (stored procedure)

Im having a bit of a mental block on this one. I got booking system for hotel rooms and it contains a table as so BookingRoomLink BookingId (FK) RoomId (FK) Start_Date End_Date I'd like to query the data to extract occupancy levels for each month. I could do this manually (ie for the past month do something like this). SELECT Book...

add days and hours in date/time field and get the updated date/time in php using mysql

I would like to provide the ability for users to submit a datetime value, along with values representing additional days/hours, and then store the datetime that results from adding the two in a mysql database. ...

SQL Count for a Date Column

Hi folks I have a table that containts a set of columns one of it is a Date column. I need to count how many occurrences of the values of that column refer to the same month. And return if for one month, that count sums more than 3. For example: ____________________ | DATE | .... | --------------------- 1998-09-02 1998-09-03 19...

How to display after 4 week date from now?I want to pass an argument.

echo date( "F jS, Y" , strtotime("now +3 weeks") ); It gives the result as July 2nd, 2010 . Fine.Now I want to pass the argument like this. The original print_r($originalamount) give the result like this Array ( [0] => 4 Months [1] => 3500 ) My code $text=trim($originalamount[0]); $text1="now +".$text; echo date...

Start and end date of a current month

I need the start date and the end date of the current month in Java. When the JSP page is loaded with the current month it should automatically calculate the start and end date of that month. It should be irrespective of the year and month. That is some month has 31 days or 30 days or 28 days. This should satisfy for a leap year too. Can...

javascript date manipulation

I have a string 2010-08-02 12:13:06.0 and need to get something like Fri Aug 6 2010 out of it (the input does not map to the output for the values I gave, just examples) I fear Im going to have to do some string manipulation to get what I want; the js Date object does not seem to have methods capable of parsing the input string. ...

MySQL: How to calculate weeks out from a specific date?

I need to calculate the weeks out from a date in my MySQL select statement. There is a date column in one of the tables, and I need to calculate how many weeks away the date is. SELECT EventDate, (calculation) AS WeeksOut FROM Events; Example: 6 days away, weeks out = 0 7 days away, weeks out = 1 13 days away, weeks out = 1 14 days ...

SQL - Retrieve values in a single query with multiple where clauses

I have a table with the following data: UserName | LastLogin ------------------------------- User1 | 2010-10-25 10:05:47 User2 | 2010-10-23 11:10:27 User3 | 2010-10-12 05:39:34 User4 | 2010-10-20 12:22:11 User5 | 2010-09-17 08:41:05 I want to be able to run a query to get the number of people who have logged in in the ...