date

how to parse date in java?

i am trying to parse this date with SimpleDateFormat and it doesnt work : import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; /** * * @author fennec */ public class Formaterclass { public static void main(String[] args) throws ParseException{ String strDate = "Thu Jun 18 20:56:02 ED...

Auto insert date and time in form input field?

Using javascript, how can we auto insert the current DATE and TIME into a form input field. I'm building a "Problems" form to keep track of user submitted complaints about a certain service. I'm collecting as much info as possible. I want to save the staff here from having to manually enter the date and time each time they open the form...

Dealing with dates and timezones, with Zend_Date

I have an application which uses Zend_Date to display dates. Zend_Date instances are created using datetime data from MySQL, user input and the current date. I would like for my users to be able to specify their timezone and for all dates to be displayed in their local time. At the moment my code works like this: $date = '2009-01-01 1...

Working with date ranges in PHP/Oracle

Hi guys, I need to work out how many different instances occur on a different day, from many different ranges. Probably best to explain it with an example. 18-JAN-09 to 21-JAN-09 19-JAN09 to 20-JAN-09 20-JAN-09 to 20-JAN-09 Using the three examples above, I need it to collect this information and display something a little like... 1...

Delphi - Save DateTime Null to DB (ADO / MySQL)

Hi, i have a delphi form with some DB Controls on it. To represent a date I use the TJvDBDatePickerEdit (from JCL), which has a nice property ShowCheckBox := True; to allow the user to enter that no date is known (DBNull). I verify, that nulling the DatePicker works as expected by: procedure Tframe.adoQueryBeforePost(DataSet: TDat...

MS-access wrong date format when converting field from text to date/time

Hi, I have an access database given to me where all the dates are stored in a text field in the format mm/dd (eg: 3/13/2009 12:20:36 AM) I want to convert the field to a date/time but access formats it as dd/mm which makes it so that if the day is bigger then 12 or not the converted date might be wrong. Example with the current forma...

How do I sum visits with an SQL query?

I am trying to filter an SQL database. Each row represents a user, the main column I’m focusing on is titled last_visited and formatted as… 2009-06-17 12:15:32. How many users have visited in the last day/week/month? Like in: SELECT COUNT(*) AS USERS_TODAY FROM parts_users Where updated_at > (NOW()-7) ...

What's a good data structure for periodic or recurring dates?

Is there a published data structure for storing periodic or recurring dates? Something that can handle: The pump need recycling every five days. Payday is every second Friday. Thanksgiving Day is the second Monday in October (US: the fourth Thursday in November). Valentine's Day is every February 14th. Solstice is (usually) every June ...

How do I combine 3 SQL queries into 1?

This is written to count how many people have visited within the last day. I want to also include how many have visited in the last week and year and have it output altogether without doing 3 separate queries. SELECT COUNT(updated_at) AS 'TODAY' FROM parts_development.page_views p WHERE updated_at >= DATE_SUB(NOW(),INTERVAL 1 day) GR...

MySQL WHERE timestamp >= SUBDATE(MAX(timestamp), INTERVAL 5 DAY)

What's the best way to express this in one SQL query? "Select a few random items that fall within x days of the newest item in the table." I tried the following: SELECT * FROM table HAVING `timestamp` >= SUBDATE(MAX(`timestamp`), INTERVAL 5 DAY) ORDER BY RAND() LIMIT 10 But this only gives me a single result, not 10. WHERE instead o...

SQL to Return Results from Week 13 Year 2008 (not grouped)

Hi folks, I'm trying to use a Year-Week format in oracle SQL to return results only from a range of Year-Weeks. Here's what I'm trying SELECT * FROM widsys.train trn WHERE trn.WID_DATE>=TO_DATE('2008-13', 'YYYY-IW') AND trn.WID_DATE<=TO_DATE('2008-15', 'YYYY-IW') ORDER BY trn.wid_date but it shoots this error. ORA-01820: format c...

How to perform date operations in hibernate HQL

Hello friends, I want to perform data time operations using hibernate hql. I want to add and subtract two dates as well as I want to subtract 1 year or 1 month from a particular date. How is this possible using HQL in hibernate. Does anyone know about it? is there any tutorial available for this? Please help if you can. Thanks. ...

Date difference in Javascript (ignoring time of day)

I'm writing an equipment rental application where clients are charged a fee for renting equipment based on the duration (in days) of the rental. So, basically, (daily fee * number of days) = total charge. For instant feedback on the client side, I'm trying to use Javascript to figure out the difference in two calendar dates. I've search...

How can I convert an Integer to localized month name in Java?

I get an integer and I need to convert to a month names in various locales: Example for locale en-us: 1 -> January 2 -> February Example for locale es-mx: 1 -> Enero 2 -> Febrero ...

How to disable future dates in WebDateChooser

Hi, I am using WebDateChooser in my .net application...by default the Date Chooser shows Current date,so that we can choose any date 10 years before the Current year and 10 years after the Current year...but i dont want to show the future date in the WebDateChooser. Is there any property to set the Maxdate as current date <igsch:WebDat...

SAS DATE issue - calculating "NEAREST MONTH"

I need to calculate a figure which equates to the 'nearest' number of months between two dates. However the standard SAS function (INTCK) is not geared to consider the DAY of its date parameters (eg code below resolves to 0 when I need it to round to 1). What is the 'neatest' way of resolving this issue? data _null_; x="01APR08"d; y...

Should different servers translate unix timestamps as different dates?

Whilst working on a UI update for a client, I noticed the dates associated with all the articles were out by a day. I figured I'd screwed something up during my changes, but to be sure, threw together a little php test file that gave me some odd results. The test file is just; <?php $date = 1246053600; echo 'unix: ',$date,', converted: ...

Best way to save only day and month in database

We have to save the day and the month of a yearly reoccurring event. (Think of it as the day of they year when the invoice has to be sent to the client.) We will have to do some computation with this information. E.g if the customer is paying twice per year. Then we do not only have to check if this day is today but also if this day is ...

Interpolating data points in Excel

Hi, I'm sure this is the kind of problem other have solved many times before. A group of people are going to do measurements (Home energy usage to be exact). All of them will do that at different times and in different intervals. So what I'll get from each person is a set of {date, value} pairs where there are dates missing in the set...

PHP Date Question

I am trying to do a little bit of math using dates in PHP. I am modifying a shoutbox, and I want to implement the following functionality. If post date = today, return time of post else if date = yesterday, return "yesterday" else date = X days ago How would I use php's date functions to calculate how many days ago a timestamp is...