date

Query by month from date field

I have a set of Access d/b's grouped already by year. within a given year, I have a field caleld REPORTDATE which is a standard mm/dd/yyyy field. However, I need to produce queries that return data by the month. For example, I just want to see records for Jan, recs for Feb, Recs for March, etc., so that I can sum them and work wwith thm....

Convert UTC to Unix Timestamp

Hi, I'm parsing an RSS feed which has the time and date as UTC, I need to convert this into a unix timestamp. Is there a simple way to do this? ...

How do I handle date objects in ruby on rails forms?

I am using a rails helper that creates 3 select lists for the purpose of letting a user select a date. If I assign the helper a name, it sets all 3 select lists to have that name, and then only the last one goes through (it overwrites the previous). What I need to know is: What is the best way to take a set of 3 select lists (day, mont...

Ruby Rails Time.change not working as I would expect...I have checked the docs!

I have a form that contains one date element and 3 time elements. This is because 3 time events will occur on one date, and I don't want the user to have to input that date 3 times. On the server side, I would like to combine the one date with the 3 times to get 3 datetime objects. I was thinking I could just do something like: time_...

Best free library or database to determine if a date is a US or international holiday?

In hopes of improving the relevance of year to year comparisons I would like to correct for the fact that the data last year fell on Easter, Labor Day, or whatever. What is the easiest way to programatically determine this information? Are any solutions known to account for international holidays? I could scrape a site like this one b...

How to insert dates selected from drop downs into mySQL table using php?

When you have 5 dropdowns for date selection (Y, m,d, H,i) how do you insert the selected date and time into a single column of a mySQL table as a datetime using PHP5? I know they need to be combined in a string such as: $DateTime="$Year-$Month-$Day $Hour:$Minute:00"; and then maybe use strtotime: $Date=date('Y-m-d H:i:s', strtotime...

Python: Date Ordinal Output?

I'm wondering if there is a quick and easy way to output ordinals given a number in python. For example, given the number 1, I'd like to output "1st", the number 2, "2nd", et cetera, et cetera. This is for working with dates in a breadcrumb trail Home > Venues > Bar Academy > 2009 > April > 01 is what is currently shown I'd li...

Best way to design a scaleable hits/analytics system?

The company I work for creates applications for the Blackberry platform. We've been working on a proprietary "analytics system" that allows us to embed code within our applications and have the applications report back some stats to our central servers every time they're run. Currently, the system works ok; however it's only in beta wit...

How can you save time by using the built in Date class?

The intention of this question is to gather solutions to date / time calculation using the built in Date class instead of writing long complicated functions. I’ll write some answers myself, and accept an answer if anyone comes up with something very clever. But this is mostly meant as a collection of solutions, since I often see overly ...

Timezone in PHP

PHP seems to use a rather annoying method for setting the evnironment timezone, using region names rather than the GMT offset. This makes having a timezone dropdown a huge pain, because it either has to be huge to accommodate all possible PHP timezone values, or I have to find a way to convert a GMT offset to a valid value to pass to PHP...

In J2ME, how can I tell whether or not Daylight Saving Time is enabled?

How can I get whether or not daylight saving time is switched on? (Because if it is on, the Calendar.HOUR_OF_DAY is (for example) 11 instead of 12.) Or should I use another way to get the hour of day? ...

Changing dateformat on a SQL Server DB and not on whole server to dd/mm/yyyy

Hi there, can anyone help, we have a sql server 2005 database installed (actually its an sql server 2000 attached to an sql server 2005 server) with the default server language language USA with dateformat like mm/dd/yy and we really need to keep it this way but currently just uploaded a new database to the server and this needs to have...

(Calendar) Hour of day doesn't return the right hour

Calendar.getInstance(TimeZone.getTimeZone("GMT+1")).get(Calendar.HOUR_OF_DAY) is an hour "slow", (possibly because they does not detect the daylight saving +1 hour.) In J2SE, there are a lot of available time zones (Europe/Budapest too, and it works perfectly), but in J2ME there are only GTM and UTC. How can I get the "right" hour? ...

Converting dates in JavaScript

How can I convert one date format to another format in JavaScript? Example: the old format is YYYY/MM/DD but I want to convert it into DD-MM-YYYY ...

PowerShell Get -Date

Hi guys I have this in PowerShell: I have a collection that have a CustomProp named "rep_date" that contains a Date in format: mm/dd/yyyy, now I want to save there the date in this format: dd/mm/yyyy, Im trying this approach: For ($i=0;$i –le $HD.count; ++$i) { $B = $HD[$i].CustomProps[‘rep_date’] = Get-Date –date $HD[$i].CustomPro...

How would I fix the last day of the month errors that result with this php code?

Hello, The code below is what I'm using for a website menu which moves the link for the current month's page to the top of the link list on the change of the month. But this fails on the 31st of some months, such as April; I get two links to the same month for most of the links. I've read through the issues with the way php generates da...

How to str_pad this PHP date selection month array ???

Needs to be padded to this: str_pad($Month, 2, "0", STR_PAD_LEFT) but how/where??? /*******creates the month selection dropdown array****/ function createMonths($id='month_select', $selected=null) { /*** array of months ***/ $months = array( 1=>'Jan', 2=>'Feb', 3=>'M...

Mapping of Oracle Date to Java type to return the number of seconds since epoch?

I have a table with an oracle date column when I do a select on sqlplus on the column it gives me the value like this 10-JAN-2007 Is this the precision of date in an Oracle column i,e does it not have hour sec, millisec in the date column. How can I map this to a java timestamp and get seconds since epoch. ...

SQL Server 2005 Date Localization

I have a procedure that defaults todays date if no parameter is passed into it. CREATE Procedure GetDirectoryRenewalReminders (@DateToday datetime = Null) As If @DateToday Is Null Begin Set @DateToday = GetDate() End ... Go How can I ensure that the GetDate() value will default to the current UK time when called f...

Make a date object take timezone into consideration

I'm using the following piece of code: $.log('Ending time: ' + ending_time); $.log('Now: ' + new Date()); $.log('Difference: ' + new Date(ending_time - new Date())); The output is the following: Ending time: Thu Apr 23 2009 14:31:29 GMT+0200 Now: Thu Apr 23 2009 11:56:02 GMT+0200 Difference: Thu Jan 01 1970 03:35:26 GMT+0100 I'm us...