dates

Code for fuzzy date to absolute date?

I need code that takes in a string and determines the date. I wrote a simple 15line function to return the date assuming it is relative. That was easy. Now i need to take in a string such as "jan 17 09" "1/2/3" (is it MM/DD/YY? or DD/MM/YY, here it means the former). I'll need ambiguous return codes or exceptions. What can i use to parse...

Get last Month of selected check boxes

I have a for loop that check whether some checkboxes are checked foreach (CheckBox chk in this.Controls.OfType<CheckBox>()) { if (chk.Checked) { //Some code here } } There are 12 checkboxes, 1 for each month. What i want is to calculate the number of days between a variable StartDate and the last month. It's hard ...

Sorting scheduled events python

So I have list of events that are sort of like alarms. They're defined by their start and end time (in hours and minutes), a range of days (ie 1-3 which is sunday through wed.), and a range of months (ie 1-3, january through march). The format of that data is largely unchangeable. I need to, not necessarily sort the list, but I need to f...

Showing timezone specific dates in views with Zend_Date

I'm storing all my dates in ISO-format, so all of them look like this: 2010-08-17T12:47:59+00:00 Now, when my application starts, I register the timezone the current user resides in. In my case, this would be "Europe/Berlin": date_default_timezone_set("Europe/Berlin"); However, when Zend_Date parses ISO dates, it overrides the defa...

Why my IEnumerable of dates doesn't contains my date

I've a list of brazilian Holidays, so I got this: [0] {01/01/2010 00:00:00} System.DateTime [1] {16/02/2010 00:00:00} System.DateTime [2] {02/04/2010 00:00:00} System.DateTime [3] {04/04/2010 00:00:00} System.DateTime [4] {21/04/2010 00:00:00} System.DateTime [5] {01/05/2010 00:00:00} System.DateTime [6] {03/06/2010 00:00:0...

MySQL how to fill missing dates in range?

I have a table with 2 columns, date and score. It has at most 30 entries, for each of the last 30 days one. date score ----------------- 1.8.2010 19 2.8.2010 21 4.8.2010 14 7.8.2010 10 10.8.2010 14 My problem is that some dates are missing - I want to see: date score ----------------- 1.8.2010 19 2.8.2010 21 3.8.2010...

I am not able to subtract two dates from each other using Ruby...why?

this is the code I have. It is a method for a contact.rb (Contact is a model): def event_delay event # find instance of contact_event puts "+++++++++++++++inside event_delay method" event_class = event.class.name event_id = event_class.foreign_key.to_sym #puts event_id contact_event_class = "Contact#{event_cl...

how to determine if date is weekend in javascript

if i have a date coming into a function, how can i tell if its a weekend day? ...

Find date ranges from a collection of dates C#

Simple question. I have an ordered collection of dates. They are UK dates btw 01/01/10 01/02/10 01/03/10 01/04/10 02/04/10 03/04/10 04/04/10 And I want to convert this into a collection of date ranges 01/01/10 -> 01/01/10 01/02/10 -> 01/02/10 01/03/10 -> 01/03/10 01/04/10 -> 04/04/10 Just to clarify, I'm trying to convert any conse...

is there anything in javascript that can convert "August" to 8 ?

i need to convert Monthname to integer of that month (and want to avoid a big switch statement). any ideas? ...

converting a date from SQL Server to C# and then to javascript gives different results on US vs. London webserver

I have an asp.net mvc calendar application (using jquery ui datepicker) and i am running into a weird situation where when i test on a US webserver i see a certain date and when i test on a London web server i see a different date (the date before) Here are the details: I am storing a date in sql server as: 2010-09-16 00:00:00.000 ...

Date formats for weeks

I'm having a difficult time, based on the documentation, of figuring out how to equate week numbers between Perl and MySQL. How would I calculate the same exact week number in both Perl and MySQL based on a unix timestamp in the same time zone? SELECT DATE_FORMAT(from_unixtime(datefield), '%Y%U') FROM table; and print strftime('%Y%U...

How do I format the date and time That is received from database

Iam getting the date and time from Database as follows Date : 20100101(YYYY/MM/DD) Time : 120912 (HH:MM:SS) I have to format the Date as follows 20100101 --> (2010-10-11) (look to have ) "-" in between year and month and Day I have to format the time as follows 120912 --> 12:02:12 suppose I may have the time as 62367 from the d...

Mysql: converting date fro 'dd/mm/yyyy' to 'yyyymmdd'

Im working on a database that store dates in a varchar(10) mysql field (so sad). I can not alter the database structure (im building a small plug-in), but i have to query the database finding rows where this data field is between the next 10 days. Example: | fid | fdate | | 1 | 10/09/2010 | | 2 | 17/09/2010 | | 3 | 19/09/20...

Javascript Date

I am trying to get a month range to insert into a CAML query, ie: 2010-09-01 and 2010-09-30. I have used the following code to generate these two values: var month = "10/2010"; var monthArray = month.split("/"); var startDate = new Date(monthArray[1], monthArray[0]-1, 1); var endDate = new Date(startDate); endDate.setMonth(startDate.ge...

How to handle different number of days in monthly subscriptions?

I'm working on a PHP subscription site and I'm wondering how the different number of days in certain months affect subscriptions? For example a user signs up the 31 of January for a monthly subscription. In February there are 28 days so I assume the subscription gets processed the 28th. My question is what happens the next month. Doe...

dealing with dates in mysql?

i have this long mysql query, and im trying to find fetch the rows that are older then the given date $lastmsg. this is the code im using: $result="SELECT u.username, u.picture,m.id, m.user_note, m.reply_id, m.reply_name, m.recycle_id, m.recycle_name, m.dt FROM relationships r, ...

Oracle query optimization using dynamic dates

I have a view where if I select like this: select * from view where date = '17-sep-10' it returns in seconds. If I use a dynamic date: select * from view where date = to_date((select current_business_date from v_business_day), 'mm/dd/yyyy') it returns in 20 mins. Why would har...

Dealing with dates in mysql?

EDIT: changed the whole question sorry, im trying to deal with the mysql DATETIME values, this is my mysql query: $result="SELECT u.username, u.picture, m.id, m.user_note, m.reply_id, m.reply_name, m. m.dt FROM relationships r, notes m, user u WHERE m.user_id = r.leader AND r.leader = u.user_id AND r.listener ='".$_SESSION['user_id']."'...

MVC ClientSide date validation

I'm using xVal and jQuery for clientside form validation in MVC. A date field annotated with [DataType(DataType.Date, ErrorMessage=...)] is being properly validated if the user types a string that does not fit into the designated format. But if the user types something with invalid month or day, e.g., 13/32/2010, it is not validate unti...