date

How can I find records from today, yesterday and so on with Ruby on Rails?

Hi, I want to find all records, say Posts, created today with Ruby on Rails, then all Posts created yesterday, and so on… how should I do? Thank you, Kevin ...

how can I delete date in this table ?

I have table like this create table tbl_1( year int, month int, day int ) insert into tbl_1 values(2009, 11, 30) insert into tbl_1 values(2010, 3, 4) insert into tbl_1 values(2011, 5, 13) insert into tbl_1 values(20011, 12, 24) I want to delete date from 2009-11-30 until 2011-5-13, but I can't because all of columns are i...

MySQL date comparison function

In my table dates are stored in the format "2010-08-26 09:00:00" so yyyy-mm-dd. I'd like to select all fields that have a date field that is "today", so between 2010-08-26 00:00:01 and 2010-08-26 23:59:59. Just using larger and smaller than operators does not work, does MySQL have some built in date comparison functions that can do this...

Client date and server date confusion.

I am working on a website in ASP.NET where emails can be scheduled for feauture. But the problem is with the date difference between server and client. As the server is in India an USA user can schedule a date behind today's date as their time zone is different. But this email will not be sent ever as the date has already been passed her...

Javascript Date decorator for accurate client side time

I'm currently working on some Javascript to synchronize the client side clock with our servers. I'm doing this by looking at the 'Date' header of any Ajax responses (it only has to be accurate to a few seconds). To make the rest of the code work seamlessly with this Date function I want to override the native Date function in a decorato...

Invalid date when installing cucumber on Ruby 1.8.6

I'm setting up a continuous integration server for an application that uses cucumber. I'm trying to install cucumber gem on ubuntu linux 10.04 but it doesn't work on ruby 1.8.6. It works on ruby 1.8.7 but it doesn't solve my problem because cruisecontrolrb demands 1.8.6. I have found this link http://www.ruby-forum.com/topic/198581, and ...

Adding n hours to a date in Java?

Hi, I'm trying to add n hours to a Date for a program, but I don't know how I can work with hours. I found on this site a question about this, it was about increamenting a date by a day. I didn't get the whole code, so I don't know how to make it with one hour. So, how do I make this? I'm guessing I have to somehow use add in calendar....

how to check "Entered date is past date"

Hello All, I need to check whether an entered date [ taking input from user in textfield] is past date or not. Thanks, Sagar ...

Global Date Handler for javascript

Hi, I have a site that uses JavaScript extensively. But my problem is now that my site is being used by various timezones the date and times are incorrect when displaying data from the server (TZ A) and Displayed on the client using JavaScript (TZ B). My site is ASP.net if that makes any difference. Originally I never catered for UTC ...

I want to calculate Saturday's and Sunday's in a date range

I want to calculate Saturday's and Sunday's in a date range? How can i ? ...

Programmatically managing a 'balance' of time (sick/vacation)

I'm using Python/Django, but this is more about the "data model" and how I interact with the information - I really just want to know if I'm crazy here. I'm working on a small app at my company (~55 employees) that will keep track of available Vacation/Sick time. Part of the purpose is to integrate "self-service" into our intranet, so ...

Wordpress: events grouped by month

Hello Within my WP site I have a category called 'events' where I am publishing event information using two custom fields: eventdate = human readable event date eventsortdate = YYYY/MM/DD to list events in the correct order. I have this bit of code from a helpful post here: http://www.davidrisley.com/events-list-with-wordpress/ <?p...

calculate total number of days in specied dates

i have one table with two columns as shown in picture table columns names are (MAXDATE,AMOUNT). if you see we have first date range (from current date to 20-jan-2010) second date range from 20-jan-2010 to 30-jan-2010 3rd range is from 20-jan-2010 to 31-jan-2010. at the execution of page user enter the start and end dat...

[cakephp] Trying to get week number out of date field

Hi, For a given date field (formatted in sql as: yyyy-mm-dd), I would like to output it as week number. I tried to work with date() but that didn't really work out. SQL field: YYYY-MM-DD Desired output: Week 12 - 2010 Does anyone know how to do this? thanks in advance!! ...

how to get current time and then compare them using jquery .

this is my code: var currentTime = new Date() var month = currentTime.getMonth() + 1 var day = currentTime.getDate() var year = currentTime.getFullYear() var hours = currentTime.getHours() var minutes = currentTime.getMinutes() alert(minutes+"/"+hours+"/"+month + "/" + day + "/" + year) but , i think it hard to compare with two t...

Java: Min and Max Date range

I'm grabbing some data from a database that has a stored date value, and I'm letting the user pick date ranges they would like to view data for. All my code for getting these date ranges works except for the method to get the date range covering all time, which would be a start value of the earliest possible data Java handles, to the end...

Issue in date comparison in MySQL

I have MySQL with below settings Server version: 5.0.77 MySQL client version: 5.0.41 Protocol version: 10 MySQL charset: UTF-8 Unicode (utf8) MySQL connection collation: utf8_unicode_ci I am just doing a simple query and it returned wrong SELECT * FROM table1 WHERE mydate >= '2010-08-30' Today is 8/30 and I have 1 row with mydate is '2...

Ruby String to Date Conversion

Hi, I am faced with an issue in Ruby on Rails. I am looking to convert a string of format Tue, 10 Aug 2010 01:20:19 -0400 (EDT) to a date object. Is there anyway i could do this. Here is what I've looked and tried at the following with no luck: Date.strptime(updated,"%a, %d %m %Y %H:%M:%S %Z") Chronic Parser Ruby: convert string to ...

FullCalendar one hour ahead

Hello. I am using a JQuery plugin to render a calendar (http://arshaw.com/fullcalendar/). Problem is that the dates are one hour ahead. I have tried looking into the files to find out where this happens. Can it be something with day light savings? I am pretty clueless. The dates from the database is correct, but once they are converte...

PHP DateTime::modify adding and subtracting months

I've been working a lot with the DateTime class and recently ran into what I thought was a bug when adding months. After a bit of research, it appears that it wasn't a bug, but instead working as intended. According to the documentation found here: Example #2 Beware when adding or subtracting months <?php $date = new DateTime('...