date

Dealing with date and time functionality in Rails

Hi guys, I have a date in the database and I want to export it to DATE_TIME.civil() format like the one shown below (I am doing this to export it to a .ics calendar file) DTSTART:20100605T083000 DTEND:20100606T083000 I have two fields in the database one called start_date and two fields start_time and end_time. I want to add...

What is the best way to increment a Java.sql.date / time?

Hello I have an issue where I have a MySQL database storing dates and times in separate columns. However, in Java code I need to increment the resulting timestamp for a date and time from the database by minutes, hours or days and then update the respective columns in the database. I'm currently using Java.sql.date and java.sql.time ty...

Retrieve missing dates from database via MySQL

Hi guys, So I have a table where I collect data for the jobs that I do. Each time I create a job I assign it a date. The problem with this is the days I don't have jobs aren't stored in the database therefore when I graph my data I never see the days that I had zero jobs. My current query looks like this: SELECT job_data_date, SUM(job...

Rails -- Can't set value for date_select in form

I'm pulling data from an API where the date data comes in as "2008-02-11 00:00:00 " I would like that data to go into my form within the date_select as a value so I can view it correctly before I add it into my database. The view looks like <%= f.label :start_date %><br /> <%= f.date_select :start_date, :value => " #{@stdate[idx]} " %...

Why are months off by one with Java SimpleDateFormat ?

Hello, I am using SimpleDateFormat to display a Calendar like this : public String getDate() { String DATE_FORMAT = "EEEE, dd/MM/yyyy HH:mm:ss"; SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT); System.err.println(date.getTime().getMonth()); return sdf.format(date.getTime()); } The shell returns 6 and the dis...

Converting string to datetime

I'm trying to enter a date in a mysql table `ssdate` datetime The function that produces the date can output it in 3 formats: 1276142400000 Thu Jun 10 00:00:00 GMT-0400 2010 Fri Jun 4 2010 I'm wondering which of these would be easiest to convert to this field format? Since I'm trying to save only the date, is there a better option...

MySQL Datetime <-> Java Date

Hello! I use Hibernate and I have a datetime in my MySQL database. Now I want to store the date/time which is a java.util.Date into the database. So I can write: SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); testObject.setCreationDate(df.parse("2010-06-06 13:20:15")); But how can I set the current date/time? Bec...

core-plot and NSDate (iPhone)

I wish to plot a line graph where the x-axis is defined as a number of days between two dates and the y-axis is a value that varies on each of the days. I can plot the y values as an NSNumber but I have no idea how to set the ranges and the markup on the x-axis. I have looked at the date example in the "examples" directory of the core-p...

How to get the current time in GMT?

Possible Duplicate: How can I get the current date and time in UTC or GMT in Java? I want to get the current timestamp in GMT; any ideas how to do that? ...

Compare two date whit jquery

Hello, i have two String fields who represent Date in my page and i would to compare this two fields to know if my first date < second date <tr> <td align="right">First Date: </td> <td align="left"> <html:text name="addPublicationForm" styleId="firstDate" property="firstDate" maxlength="10"/></td> </tr> <tr> <td align="right">Second Dat...

How to check or validate the textbox entered date is in DD/MM/YYYY format?

How to check or validate the textbox entered date is in DD/MM/YYYY format? ...

Last time the contact was modified

Hey, is there a way to find out the last time a contact was modified? I can't seem to find a variable for it. The reason I'm asking is because I'd like to do a sync of the contacts to my web server and I don't feel like checking for each contact with a HTTP request if it needs updating. So I was thinking to check the date of the last u...

Java: How to check if a date Object equals yesterday?

Right now I am using this code Calendar cal = Calendar.getInstance(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DATE) - 1, 12, 0, 0); //Sets Calendar to "yeserday, 12am" if(sdf.format(getDateFromLine(line)).equals(sdf.format(cal.getTime()))) ...

Btrieve Date Integer

Hi everyone, this is my question: I'm migrating data from a Btrieve file (.dat) through Pervasive Control Center and there is field type which is defined as integer but is a date and for example the date '31/12/2009' (seen in the legacy system) is view it as the number 733772 when I export it. The legacy system shows the date correctly...

php / mysql / javascript mindate and maxdate

Hi, In .net, there are the static properties DateTime.MinDate, and DateTime.MaxDate that conveniently return the minimum and maximum valid dates for a DateTime object. I'm dabbling in web programming right now, using php + mysql + javascript. There doesn't seem to be the same convenient min/max date values in that programming environme...

converting a UTC time to a local time zone in Java

I know this subject has been beaten to death but after searching for a few hours to this problem I had to ask. My Problem: do calculations on dates on a server based on the current time zone of a client app (iphone). The client app tells the server, in seconds, how far away its time zone is away from GMT. I would like to then use this i...

Way to store dates with missing days/months in mysql (php)

I want to store dates in mysql so I set the table to be of type 'Date', which is fine but mysql requires that the full date is provided YYYY-MM-DD. However some of my data does not include day and some is missing the month. Now I could just use a varchar(10) field, but then its difficult to run date based queries on the data. Is there ...

Comparing two date / times to find out if 5 mins has lapsed between the two times php

I need to compare two dates to show an edit link if it is within 5 mins after the post was made, in php. If after 5 mins dont show anything. $answer_post_date = get_the_time("Y-m-d"); $current_date = date("Y-m-d"); $formated_current_date = strtotime($answer_post_date); $formated_answer_post_date = strtotime($current_date); At this p...

String to date (Invalid format)

I am using Joda Time library to convert my String dates to a real date, because this seemed like the easiest solution to do this. I am using the DateTime object to do this; new DateTime(strValue); But when inserting some formats it throws me the exception; java.lang.IllegalArgumentException: Invalid format: "Mon, 30 Sep 2002 01:56:0...

Group by date range on weeks/months interval

I'm using MySQL and I have the following table: | clicks | int | | period | date | I want to be able to generate reports like this, where periods are done in the last 4 weeks: | period | clicks | | 1/7 - 7/5 | 1000 | | 25/6 - 31/7 | .... | | 18/6 - 24/6 | .... | | 12/6 - 18/6 | .... | or in the last 3 months: ...