I have a PHP function that gets passed a date in the format MM/DD/YYYY I need to then convert this so that it can be added to a MySQL field that is of type date  How would I go about doing this in PHP?
19261
I have a datetime column in MySQL.   How can I convert it to the display as mm/dd/yy H:M (AM/PM) using PHP?
76453
I'm reading a field value and its format from the database. How would I render that value with the format?
1510
I'm working with a date in this format: yyyy-mm-dd.  How can I increment this date by one day?
23049
Using standard mysql functions is there a way to write a query that will return a list of days between two dates.  eg given 2009-01-01 and 2009-01-13 it would return a one column table with the values:   2009-01-01   2009-01-02   2009-01-03  2009-01-04   2009-01-05  2009-01-06  2009-01-07  2009-01-08   2009-01-09  2009-01-10  2009-01-11  2009-01-12  2009-01-13   Edit: It appears I have not been clear. I want to GENERATE this list. I have values stored in the database (by datetime) but want them to be aggregated on a left outer join to a list of dates as above (I am expecting null from the right side of some of this join for some days and will handle this).
106168
I need to add 30 minutes to values in a Oracle date column.  I do this in my SELECT statement by specifying   to_char(date_and_time + (.000694 * 31)  which works fine most of the time.  But not when the time is on the AM/PM border.  For example, adding 30 minutes to 12:30 [which is  PM] returns 1:00 which is AM. The answer I expect is 13:00.  What's the correct way to do this?
106787
Suppose I have a date, i.e. year, month and day, as integers. What's a good (correct), concise and fairly readable algorithm for computing the   of the week the given date falls into? I have come across some truly horrendous code that makes me think surely there must be a better way.  I'm looking to do this in Java but psuedocode for any kind of object-oriented language is fine.
56801
I have a function like this:  DROP FUNCTION IF EXISTS user_repo // CREATE FUNCTION user_repo(user_id INT) RETURNS VARCHAR(20) BEGIN     DECLARE vote_value mediumint;     DECLARE score mediumint;      SELECT coalesce(sum(r.vote_value), 0), coalesce(sum(r.score), 0)       INTO vote_value, score     FROM reputations     WHERE owner_id = user_id       AND date_time &gt; unix_timestamp(DATE_SUB(now(), INTERVAL 1 WEEK));      RETURN CONCAT_WS(',', vote_value, score); END;//   It works as well. Now I want to also pass another parameter to the function to determine the time range. I mean I want to pass a string instead of  WEEK. Here is my new function:  DROP FUNCTION IF EXISTS user_repo // CREATE FUNCTION user_repo(user_id INT, range VARCHAR(10)) RETURNS VARCHAR(20) BEGIN     DECLARE vote_value mediumint;     DECLARE score mediumint;      SELECT coalesce(sum(r.vote_value), 0), coalesce(sum(r.score), 0)       INTO vote_value, score     FROM reputations     WHERE owner_id = user_id       AND date_time &gt; unix_timestamp(DATE_SUB(now(), INTERVAL 1 range));      RETURN CONCAT_WS(',', vote_value, score); END;//   But it throws this error:     The following query has failed:   CREATE  DEFINER=`root`@`localhost` FUNCTION `user_repo`(`user_id` INT,                 `range` VARCHAR(10) CHARSET utf8)        RETURNS VARCHAR(20) CHARSET utf8mb4        NOT DETERMINISTIC        CONTAINS SQL SQL        SECURITY DEFINER BEGIN DECLARE vote_value mediumint; DECLARE score mediumint; SELECT  coalesce(sum(r.vote_value), 0), coalesce(sum(r.score), 0)     INTO  vote_value, score     FROM  reputations     WHERE  owner_id = user_id       AND  date_time &gt; unix_timestamp(DATE_SUB(now(), INTERVAL 1 range)); RETURN CONCAT_WS(', ', vote_value, score); END      MySQL said: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'range)); RETURN CONCAT_WS(',', vote_value, score); END' at line 9   Does anybody what's wrong?
76394
I need to do a date comparison in Mysql without taking into account the time component i.e. i need to convert '2008-11-05 14:30:00' to '2008-11-05'  Currently i am doing this:  SELECT from_days(to_days(my_date))   Is there a proper way of doing this?
25978
Presently the date is showing as mmm dd hh:mm:ss. Is there any way that I can change it to as per my liking. For example : dd mmm, hh:mm:ss.
46064
How can I go about displaying a date that is formatted to a users locale, for example me and my Australian friends use the format dd/MM/yyyy, while the Americans amoung us use MM/dd/yyyy. I know I can format a date in visualforce like so  &lt;apex:outputText value="{0,date,dd/MM/yyyy}"&gt;     &lt;apex:param value="{!myDateValue}" /&gt;  &lt;/apex:outputText&gt;   but how can I use the salesforce locale,   but how can I use these on my page?  I have found a very comprehensive solution , but I was hoping someone new of an inbuilt, or more elegant way.
2888
I'm building a quick csv from a mysql table with a query like:  select DATE(date),count(date) from table group by DATE(date) order by date asc;   and just dumping them to a file in perl over a:  while(my($date,$sum) = $sth-&gt;fetchrow) {     print CSV "$date,$sum\n" }   There are date gaps in the data, though:  | 2008-08-05 |           4 |  | 2008-08-07 |          23 |    I would like to pad the data to fill in the missing days with zero-count entries to end up with:  | 2008-08-05 |           4 |  | 2008-08-06 |           0 |  | 2008-08-07 |          23 |    I slapped together a really awkward (and almost certainly buggy) workaround with an array of days-per-month and some math, but there has to be something more straightforward either on the mysql or perl side.   Any genius ideas/slaps in the face for why me am being so dumb?    I ended up going with a stored procedure which generated a temp table for the date range in question for a couple of reasons:   I know the date range I'll be looking for every time The server in question unfortunately was not one that I can install perl modules on atm, and the state of it was decrepit enough that it didn't have anything remotely Date::-y installed   The perl Date/DateTime-iterating answers were also very good, I wish I could select multiple answers!
75387
Suppose I have a particular date stored in a variable date_m. I want ((date_m)-25) date.   For example: I have 15/09/2014 stored in my variable , then I want 21/08/2014 returned if I subtract 25 from the date stored in variable.
27348
Why do we have 2 date fields in the wp_posts? What's the purpose of the post_date_gmt? When does storing the greenwich time get handy?
7271
Is it possible in PHP to do something like this? How would you go about writing a function? Here is an example. The order is the most important thing.  $customer['address'] = '123 fake st'; $customer['name'] = 'Tim'; $customer['dob'] = '12/08/1986'; $customer['dontSortMe'] = 'this value doesnt need to be sorted';   And I'd like to do something like   $properOrderedArray = sortArrayByArray($customer, array('name', 'dob', 'address'));   Because at the end I use a foreach() and they're not in the right order (because I append the values to a string which needs to be in the correct order and I don't know in advance all of the array keys/values).  I've looked through PHP's internal array functions but it seems you can only sort alphabetically or numerically.
1
What is the most efficient way to convert a MySQL query to CSV in PHP please?  It would be best to avoid temp files as this reduces portability (dir paths and setting file-system permissions required).  The CSV should also include one top line of field names.
10781
How can I specify a custom date formate to be validated with the  for jQuery?
82186
I would like to filter a datetime field but I only want to filter MONTH  var requestUri = "xxxx/getByTitle('Contact')/items?$select=CellPhone,mdate,ddate&amp;$filter= Birthday ge '" + today + "'";   The query is working fine and I also tried month(birthday) as it was in the odata specifications but didn't work.  How can I get the month from the Birthday Datetime field.I can get it from my today variable.