date

Order items by date string in PHP?

I'm working on WordPress theme which has some custom functionality which includes the ability to add "events" that include a start and/or end date in string format. I'm wondering what the best method would be to parse these date strings in order to figure out which event should be shown in what order? Here's an example of the date stri...

Javascript Date: Ensure getMinutes(), getHours(), getSeconds() puts 0 in front if necessary

Hi all, Looking for a creative way to be sure values that come from the getHours, getMinutes, and getSeconds() method for the javascript Date object return "06" instead of 6 (for example). Are there any parameters that I don't know about? Obviously I could write a function that does it by checking the length and prepending a "0" if need...

Data actualization

I created a class called DataManager and within it I called Calendar.getInstance(), this class is running on a server with exchange of sockets, but every time you change a socket, the date is never updated, it always displays the same date as the date when the class was instantiated the first time. I would have to create a thread only to...

help with php dates and loops

Hello I currently have this PHP Script <?php if($purchase_dates != FALSE){?> <?php foreach($purchase_dates as $id=>$outer_value) { ?> <!-- Output the date here --> <!-- Start Purchase table --> <? $date =...

Handling MySQL datetimes and timestamps in Java

In a java application what would a good compromise in terms of extracing and inputting date information with a MySQL database using a mix of datetimes and timestamps? ...

Better Way to Handle Dates in Where Clause

I was wondering which type of query is better to use: SELECT * FROM table WHERE DATE >= '2010-7-20' AND DATE <= '2010-7-24' OR SELECT * FROM table WHERE DATE_SUB('2010-07-24',INTERVAL 4 DAY) <= DATE ...

How to check the data format in PHP

Hi guys. I am trying to check a date format to see if I can check the data variable has certain format like MM-DD-YYYY. if not, then exit(). I am not sure how to check the format and would appreciate if any one can help me about it. Thanks... $date=05/25/2010; if(XXXXX){ // do something.... } ...

PHP Date format question....

Hi guys. Some folks helped me on http://stackoverflow.com/questions/3326316/how-to-check-the-data-format-in-php post but I need to check two date formats MM-DD-YYYY and DD-MM-YY instead of one. Do I need to setup two regular expression???? Thanks for the help!!! $date1=05/25/2010; $date2=25/05/10; //I wish both of them would...

Date regular expression question...

Hi guys.. I have been working on my date regular expression all day... I want a date format to be YYYY-MM-DD. $date_regex ='^(19|20)\d\d[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])$'; if (preg_match($date_regex, $dateString)) { echo "good format"; } keeps giving me error preg_match() [function.preg-match]: No e...

PHP..How to print month only from a date variable...

Hi guys.. I have a date variable like 10-25-1998 and I only want to echo 10. Can anyone help me about it? Thanks... $dateString=date("m-d-Y", mktime(0,0,0,10,25,1998)); echo date('m', $dateString); // not working here....will print out 01 ...

Comparing hours and minutes in AS3

Is there a way to compare the current time to a bunch of times (loaded from XML) and have it figure out which is the closest to the current time? ...

Help with a MySQL Unix timestamp Query

I am trying to create a custom MySQL for use with the Expression Engine CMS. The purpose of the query is to display events that are happening today or in the future. The problem is that the EE field type that allows you to put in the date and converts it into a unix timestamp. If I pick the 26th July it puts in the date value "25th July...

Retrieve data Mysql / Php where date

hey, I'm wondering how to retrieve data from my database using php to get the top songs today. Right now I'm just getting the top songs using $result = mysql_query("SELECT tag, COUNT(*) AS the_tags FROM tags GROUP BY tag ORDER BY the_tags DESC LIMIT 16"); I am also storing the date in the tags table aswell, in the format 07-25-201...

PHP - linux/unix CTIME (inode change time) is being set when it's only being modified.

According to: http://www.php.net/manual/en/function.filectime.php "In most Unix filesystems, a file is considered changed when its inode data is changed; that is, when the permissions, owner, group, or other metadata from the inode is updated." However, running Debian linux (uname -r: 2.6.26-2-686) when I access and write to a file, s...

PHP: How to calculate person's age in months+days ?

I want to calculate person's age in months plus days using date of birth (example: 1986-08-23). For example: 0 months and 25 days old. 5 months and 20 days old. 150 months and 4 days old. 285 months and 30 days old. Any Idea? Thanks. ...

For loop skipping rows in DataSet

Hi! My Application uses For...Next loops to read a spreadsheet into a DataSet and then display information from it based on the results of search conditions (search term and a date range). I'm having a problem with the data where, if I run a search that should return the first 400 rows in the spreadsheet, I'm only getting around 200 re...

PHP: How to get a Date when a person reach to a specific age?

I am working on task in which dates are involved. I have a person's age in months+days. Now I want to get a date when this person reach to a specific age in months. For example: A person is 250 months and 15 days old on 2010-1-25. On which date this person will become 300 months old? Function Signature may be: function getReqDate( ...

PHP: How to get Day using Y-m-d ?

I am trying to get Day(Monday, Tuesday, Wednesday,...) using "Y-m-d" date format but it is not giving me exact day. For example: date("l","2014-07-26"); // Output: Thursday But output should be: Saturday Thanks ...

Templatetag calendar raises error

I'm tyring to use this snippet as my event calendar. Unfortunately it constantly raises new errors. Currently I get: TemplateSyntaxError at /event/while-rendering-nothing-repeat/ Caught an exception while rendering: 'NoneType' object has no attribute 'date' I'm pretty sure it comes from the line : if day >= event.date.date() and day...

json date object to php date

Hi, I am calling a webservice which return me back a json object. The json object encodes the date. I am trying to find a way to convert that date to m-d-Y format in php. Json object is {"DateOfBirth":"\/Date(387518400000-0400)\/"} this date is 02-15-1982. The webservice which I am calling is in .NET, and it converts the date to the...