date

Is there a MySQL setting to ignore "time" portion of datetime constant when applied to "DATE" column?

Disclaimer: this is needed for an old and ugly codebase that I'd much rather not touch. There is a table in the database that has a column (among many others) of DATE type. There is a query (auto generated by Torque criteria - don't ask) with java.util.Date parameter; Torque formats it as full datetime. So, the query MySQL is get...

Sending date to database with php

Hi guys I was wondering if you could help me if the folliwng: I have a calendar that inserts dates in hidden fields like this: <input name="selDay_start1" type="hidden" id="selDay_start1" /> <input name="selMonth_start1" type="hidden" id="selMonth_start1" /> <input name="selYear_start1" type="hidden" id="selYear_start1...

PHP date calculate

Here is what i try to get. i need the date format in php as this : 2009-11-29 $startdate = (date("Y")-1) .'-'. date("n") .'-'. (date("j")-1); $enddate = date("Y") .'-'. date("n") .'-'. (date("j")-1); $myAnalytics->setDateRange($startdate,$enddate); echo 'Statistiques entre : ' . $startdate .' et ' . $enddate . '<br/><br/>'; i can ...

PHP - next day 6pm

<?php $start_date = "12/10/2009 11:30"; echo "<br>start_date: $start_date<br>"; $due_date1 = date("m/d/Y H:i", strtotime("+1 day".$start_date)); $due_date2 = date("m/d/Y H:i", strtotime("+2 day 6pm".$start_date)); echo "<br>due_date1: $due_date1<br>"; echo "<br>due_date2: $due_date2<br>"; ?> See my code , I'm trying to get two dat...

How do I format an amount of milliseconds into minutes:seconds:milliseconds in PHP?

I have a total ammount of milliseconds (ie 70370) and I want to display it as minutes:seconds:milliseconds ie 00:00:0000. How can I do this in PHP? ...

Converting a string formatted YYYYMMDDHHMMSS into a JavaScript Date object.

Hello, I have a string with a date in it formatted like so: YYYYMMDDHHMMSS. I was wondering how I would convert it into a JavaScript Date object with JavaScript. Thanks in advance! ...

What does it mean to return the client?

What does it mean to "return the client?" My teacher asked in an assignment to write a method that will return the date and the client. Here is her exact wording: " You should also override the ToString method, to return the date and the client. (DateTime has a reasonable ToString method defined. Use it.) I found using "\t" (the tab s...

How to put a date from strftime in a nsstring in obj-c?

i want to be get a date (the current hour) from strftime and get it into a nsstring in obj-c for the iphone-os ...

How to validate a model's date attribute against a specific range (evaluated at run time)

I have several models with a date attribute and for each model I'd like to validate these dates against a given range. A basic example would be: validates_inclusion_of :dated_on, :in => Date.new(2000,1,1)..Date(2020,1,1) Ideally I'd like to evaluate the date range at runtime, using a similar approach as named_scope uses, e.g: valid...

Basic excel date and time problem

Hi everyone, Have a list of dates in excel in the format (this comes originally from csv): 23/11/09 07:27:02 23/11/09 08:01:50 23/11/09 08:38:58 23/11/09 09:40:01 What I want to do is count the number of these falling between hour blocks, like 7-8, 8-9, 9-10 etc Not sure how to get started, but one idea was just to put logic statemen...

Javascript Add Date Problem

Hi, I've this snippet: var d1 = parseInt( document.getElementById('day1').value ); var m1 = parseInt( document.getElementById('month1').value ); var y1 = parseInt( document.getElementById('year1').value ); var dt = new Date(); dt.setYear(y1); dt.setMonth(m1); dt.setDate(d1 + 1); document.getElementById('day2').value = dt.getDate(); d...

C# - Difference between two dates?

I am trying to calculate the difference between two dates. This is what I'm currently using: int currentyear = DateTime.Now.Year; DateTime now = DateTime.Now; DateTime then = new DateTime(currentyear, 12, 26); TimeSpan diff = now - then; int days = diff.Days; label1.Text = days.ToString() + " Days Until Christmas"; All works fine ex...

How can I get file's modification date in DDMMYY format in Perl?

What's the best way to do it? EDIT: Originally the question was "How to do it without the DateTime module". I removed this restriction in order to make the question more general. ...

PHP date comparison

How would I check if a date in the format "2008-02-16 12:59:57" is less than 24 hours ago? ...

Is it possible to save year 1 to 99 as date-value in Access database?

Access automatically converts any value under 100. ie: 0099 converts to 1999 and 0010 to 2010 and 0001 to 2001. Is there any way around this problem or is it not possible to save dates in Access so far away? ...

Parse Date in Bash

I need to parse a date (format: YYYY-MM-DD hh:mm:ss) in bash. I'd like to end up with all fields (years, months, days, hours, minutes, seconds) in different variables. ...

Parsing a RFC 822 date with NSDateFormatter

I'm using a NSDateFormatter to parse a RFC 822 date on the iPhone. However, there is no way to specify optional elements in the date format. There are a couple of optional parts in the RFC 822 specification which is breaking the date parser. If nothing works out, I'd probably have to write a custom parser to obey the specs. For example,...

MySQL: keep server timezone or user timezone?

Hello, I'm thinking about to store dates on user login in my site, but I don't know what is the most logical solution. Initially, I though to use server timezone, and then to manage it using difference operations between server machine date and user machine date, but I've also considered to change it direclty using timezone and php clas...

How to determine UTC offset from server timezone?

I've found many examples about UTC tables and php date methods to convert it, but I still miss a simple way after got server date, to converting it into an user timezone selection on my web page. On this page http://vkham.com/UTC.html I've found a clear guide to understand the range, but I don't know how to connect for example "Europe/R...

Javascript "Invalid Date" error in Safari.

Hello, I've been trying to debug a script of mine and I can't get my head around what's wrong with this: var date = new Date("19871104071535".replace( /^(\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)$/, '$4:$5:$6 $2/$3/$1' )); alert(date); It works in Firefox, IE, Chrome but Safari gives me an "Invalid Date" error. Any ideas? ...