date

How do I create a form that submits two dates and outputs the report?

I currently have a controller which produces a report. This is the controller: def last5days #@monday = (Time.now).at_beginning_of_week @monday = (Time.now).months_ago(1) #@friday = 5.days.since(@monday)-1.second @friday = (Time.now) @sent_emails = ContactEmail.all(:conditions => ['date_sent >= ? and date_sent <= ...

How to insert date(y-m-d) into MySQL database ?

I have a field of type date in MySQL. When I try to insert any date in this field with PHP using following query, It stores 0000-00-00 in that field. For example: UPDATE test SET dob=2000-09-20 WHERE id=3 ...

JSpinner SpinnerDateModel question

Hi, I'm trying to create a JSpinner to enable the user to pick a Date. I want there to be a lower date limit and an upper date limit. I also want the initial value to be the lower date limit. Unfortunately, My problem is that it won't let me use the lower limit as the initial value (the JSpinner simply becomes unresponsive). Here is my c...

Informal PHP date output library

Hi there, is there a library out there for PHP that formats dates in an informal way? I would love to have outputs like yesterday, 2 minutes ago, just now, three weeks ago – just like in Facebook. Makes blog posts appear so much more human. Thanks in advance for your help. ...

Overcoming timezone differences in MySQL Select

Hi everyone, I am trying to select entries for a current date but cannot seem to get past the issue of a 1 hour time difference between my timezone and that of the server. I was able to overcome this by using DATE_ADD() for adding entries but now I need to do the same to SELECT them. I tried inserting SET time_zone = 'America/New_York'...

ADO.NET Insert Min Value into SQL Server 2008 Date column crashes

Hi, I'm trying to do the following: using (var tx = sqlConnection.BeginTransaction()) { var command = sqlConnection.CreateCommand(); command.Transaction = tx; command.CommandText = "INSERT INTO TryDate([MyDate]) VALUES(@p0)"; var dateParam = command.CreateParameter(); dateParam.ParameterName = "@p0"; dateParam.DbType = DbType.Dat...

How to plot data against specific dates on the x-axis using matplotlib

I have a dataset consisting of date-value pairs. I want to plot them in a bar graph with the specific dates in the x-axis. My problem is that matplotlib distributes the xticks over the entire date range; and also plots the data using points. The dates are all datetime objects. Here's a sample of the dataset: data = [(DT.datetime.strpt...

error with using localtime conversion in javascript time function

<script type="text/javascript"> //Live Javascript Server Time function getthedate(city, offset){ // create Date object for current location d = new Date(); // convert to msec // add local time zone offset // get UTC time in msec utc = d.getTime() + (d.getTimezoneOffset() * 60000); // create new Date object ...

How to parse follow date in Java?

Hello i need to parse this string Sun, 15 Aug 2010 3:50 PM CEST I'm using SimpleDataFormat in this way String date = "Sun, 15 Aug 2010 3:50 pm CEST"; DateFormat formatter = new SimpleDateFormat("EEE, dd MMM yyyy h:mm a Z"); Date d = formatter.parse(date); but it throws an exception. Can you help me please? Thanks ...

Facebook Interview Question: Formatting a collection of times for a movie show time output (using Linq is preferred)

class TimeObject { DateTime time; bool isMatinee; } Given: {8:00, 9:30, 11:00, 12:10, 2:00, 4:00, 5:20} -- a collection of TimeObjects Output: (8:00AM, 9:30, 11:00, 12:10PM, 2:00), 4:00, 5:20 -- return a string, oh and AM/PM should be picked up from localization strings Caveats: AM/PM only shown for first time, ( ) encloses th...

UTC support for comparing 2 files date/time

I have a utility that compares a source and destination file date/time. This works in most cases but fails when comparing date/time for files in different time zones. So I need a UTC datetime routine. From looking around it seems the Windows API GetFileTime will support this. I also found this wrapper procedure, but it crashes on the...

day of month and month identity from day of year

eg. let say it is the 326 day of the year. you want to be able to get the month and the day of the month eg. Oct 23 etc. what is the formula. how do i achieve this in php. ...

change date into words in php

I have an array of dates which are in the format 20100808 (YYYYMMD). How can i change this into August 08 2010? I am using php. I cannot change the date array format. It will be in 20100808 only. ...

How to get date representing the first day of a month?

I need functionality in a script that will enable me to insert dates into a table. What SQL do I need to insert a date of the format 01/08/2010 00:00:00 where the date is the first day of the current month. What do I need to change order that I can specify the month value? Thanks ...

Java date/time format

How can I format: "2010-07-14 09:00:02" date to depict just 9:00? ...

Difference between Date(dateString) and new Date(dateString)

I have some code that tries to parse a date string. When I do alert(Date("2010-08-17 12:09:36")); It properly parses the date and everything works fine but I can't call the methods associated with Date, like getMonth(). When I try: var temp = new Date("2010-08-17 12:09:36"); alert(temp); I get an "invalid date" error. Any ideas on...

PHP convert date from a MySQL query

Hi all, I think this is a simple question. We have a MySQL database with a DATE field, the date is stored in US format (2010-06-01). In my PHP page where I'll display the date, I simply want to convert this date into a UK format (01-06-2010). Any help and advice appreciated! Thanks, Homer. ...

How to make GWT DatePicker to use Monday as the first day of the week?

Pretty much, what the title says. I need to make the GWT DatePicker component use Monday as the first day of the week. Currently the day labels are S M T W T F S, I want it to be M T W T F S S. Any way to accomplish it? ...

Validate two dates of this "dd-MMM-yyyy" format in javascript.

I have two dates 18-Aug-2010 and 19-Aug-2010 of this format. How to find whether which date is greater? ...

Convert ISO 8601-formatted time period to ticks / miliseconds

Is there a built-in way in .NET 3.5 to convert an ISO 8601 period into a .NET TimeSpan / ticks / miliseconds? ...