date

Week number and Week day

I have week number of current year and week day generated by date() like this. $week_number = date('W'); $week_day = date('w'); I need to format this. How can I get starting date of this week? Or day of month with $week_number and $week_day? ...

age calculation in Flex

I'm trying to calculate age in flex. I've found this previous question http://stackoverflow.com/questions/41763/what-is-the-best-way-to-calculate-age-using-flex I'm sort of leaning towards this private function calculateAge(dob:Date):String { var now:Date = new Date(); var ageDays:int = 0; var ageYears:int = 0; var ageRmdr:in...

Timezone differences between PHP and MySQL

I've run in to an issue whereby PHP and MySQL seem to disagree on which timezone they should be using when converting certain timestamps back to date and time. The problem arises when I have a timestamp which I would like to convert back to a datetime format. PHP gives the date and time based on GMT being the timezone, but MySQL seems t...

PDO::PARAM for dates?

Hi, does exist some PDO::PARAM_??? which can be used for dates or timestamps? $sql = "UPDATE my_table SET current_date = :date WHERE id = 43"; $statement = $pdo->prepare ($sql); $statement->bindParam (":date", strtotime (date ("Y-m-d H:i:s")), PDO::PARAM_STR); $statement->execute (); ...

Java SimpleDateFormat for time zone with a colon seperator?

I have a date in the following format: 2010-03-01T00:00:00-08:00 I have thrown the following SimpleDateFormats at it to parse it: private static final SimpleDateFormat[] FORMATS = { new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"), //ISO8601 long RFC822 zone new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssz"), //ISO8601 long l...

Sql by hour starting at noon

I'm currently using a select statement with one column as DATEPART(hh, CallTime) AS Hour and then doing: GROUP BY DATEPART(hh, CallTime) ORDER BY Hour This displays the hours starting at midnight and going through midnight - how would I go about having this go from noon to noon? Thanks! ...

How to get the Python date object for last Wednesday.

Using Python I would like to find the date object for last Wednesday. I can figure out where today is on the calendar using isocalendar, and determine whether or not we need to go back a week to get to the previous Wednesday. However, I can't figure out how to create a new date object with that information. Essentially, I need to figu...

Subtracting a certain number of hours, days, months or years from date

Hi, I'm trying to create a simple function which returns me a date with a certain number of subtracted days from now, so something like this but I dont know the date classes well: <? function get_offset_hours ($hours) { return date ("Y-m-d H:i:s", strtotime (date ("Y-m-d H:i:s") /*and now?*/)); } function get_offset_days ($days) { ...

Unable to correctly retrieve Date value from Word Template VB6 Macro

I've modified a Word Template's VB6 Macros to retrieve a Date of Birth Field. Unfortunately, when the value is retrieved it has a string value prefixed by a little square block and a lot of right-padded spaces which I can't seem to trim (eg. "1/3/57 "). Can anyone here see what the problem is? Here's the code - If ActiveDocument.B...

Set a locale in javascript

Jquery test the validity of a date via: !/Invalid|NaN/.test(new Date(value)) new Date(dateString) is the same as Date.parse(dateString) and uses browser/os locale to parse the string. im trying to parse DD/MM/YYYY but i get an error because my browser is looking for MM/DD/YYYY. Since my product will be used only by DD/MM people, i wa...

Javascript Date difference bug ?

Edit: It's not a bug as Martin pointed out. I'm just crossing the daylight saving time, hence the 1h difference. I want to calculate the difference in days between "Mar 29 2010" and "Mar 09 2010" so i have the following code: ((new Date(2010, 2, 29)).getTime() - (new Date(2010, 2, 8)).getTime()) / 86400000 86400000 is the number of m...

DateTime convert to Date and then back to DateTime in C#

I use this to convert DateTime value into Date and then I add 00:00:00 and 23:59:59 to make sure whole day is taken into consideration when counting stuff. I'm pretty sure it's wrong way of doing things. What would be the right way? DateTime varObliczOd = DateTime.Parse(dateTimeWycenaPortfelaObliczDataOd.Value.ToShortDateString(...

What happened on Dec 31 1969 at 7:00 PM

Every time in PHP when I make a variable such as this one: $date = strtotime($row['date']); $date = date("M d Y \a\\t g:i A", $date); // Mmm dd YYYY at h:mm PM/AM and somehow row['date'] happens to be 0, the date Dec 31 1969 at 7:00 PM is displayed on the screen? Google does not tell me much, I was wondering if this date had any signi...

In java, Date() method returns a value. but I am confused in that.

I used Date() for getting the date of my birthday, but it was returned the mismatch of the month. My birthday is 04-March-87. so i gave an input as, Date birthDay= new Date(87,03,04,8,30,00); But it returns correct year, day and time. But month was problem. It displays April month. What's wrong with that? ...

Detecting a US Holiday

What's the simplest way to determine if a date is a U.S. bank holiday in Python? There seem to be various calendars and webservices listing holidays for various countries, but I haven't found anything specific to banks in the U.S. ...

Make a disabled, formatted NSTextField update on a locale change?

I've got a couple of NSTextFields in my application for entering date and time. They have NSDateFormatters (using NSDateFormatterBehavior10_4) attached to them. When I change the system date format in System Preferences, then switch back to my application, the text fields automatically update with the new date format, but only if they ...

How check if today is sunday with Java Calendar

I wrote few lines of code which doesn't work correctly. Why? Could sb explain me? Calendar date = Calendar.getInstance(); date.set(2010, 03, 7); if(date.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) System.out.println("OK"); ...

get number of weeks away from today

i have a date in the future and i want to find out how many weeks away this is. ...

Select from table by knowing only date without time (ORACLE)

Greeting People, I'm trying to retrieve records from table by knowing the date in column contains date and time. Suppose I have table called t1 which contains only two column name and date respectively. The data stored in column date like this 8/3/2010 12:34:20 PM. I want to retrieve this record by this query for example (note I don'...

How to give a input date format in iphone

Hi, i am new to iphone development. In my input date format is "2010-03-05T18:20:40Z", and i donno to how to give a input format of my code.So i have mentioned in my code (?). input date format = "2010-03-05T18:20:40Z" Here my code is: NSString *indate = @"2010-03-05T18:20:40Z"; NSDateFormatter *inputFormatter = [[NSDateFormatter allo...