Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have a string which is saved into a database on form process.
I want to create a script which scans the string for any potential dates.
For example:
"The client told us to ring him back this Saturday" "The patient has
an appointment scheduled for 10/10/2013" "Call him back at the end of
the month"
If any of these cases are found, a prompt should appear asking if we would like to create a reminder for that specific date.
PHP has a strtotime function, that can read dates like "this Saturday", and the usual 4/5/2014. You can use a regular expression, like this, to pull out the simple dates:
\d+\/\d+\/\d+ # e.g., 10/10/2012
And relative dates, with something like this.
(this|next|last|on) (Sat|Sun|Mon|Tues|Wedns|Thurs|Fri)day
Then another for months, and "tomorrow", and anything else you like. It'll get pretty complicated, but you can join them all together like (regexp1|regexp2|regexp3).
The great thing about strtotime is that it will just return false if it doesn't understand, so you don't need to be too exact.
If these aren't necessarily being processed the same day, you can also pass a timestamp from when the original entry was created.
Some things like "at the end of the month" you're going to have to do manually. strtotime reads a lot, but it's not that detailed.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have a table wich contains:
RO;DE;ES;AU;IT;
How display data where DE is show on table! I need for milions queries!
It seems like you have multiple values in the same "cell". You will need to process the string. One way is to use wildcards:
SELECT something FROM something WHERE field LIKE '%DE%'
Please note however that your table design is absolutely terrible. It violates the first normal form. You should never have multiple values in a single cell that you then have to split using wildcards or other string functions. This adds overhead to your queries and will slow them down significantly. You say that you have millions of records, the impact of not having separate values has the potential to be quite large.
You should definitely think of breaking those strings into multiple records if you can.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I want to create something like this:
I've been able to create it statically, just type int everything fixed in the code. I want to have it done dynamically, I've built the database which consists of all the data I need to have in this table.
But what I can't figure out how to achieve is the first two rows (Day and Date). Other than that, I can fill all from the data base (Group Members and data associated with.
Can someone direct me on how to achieve first two rows? or should I also set them with the data in the database?
EDIT
I need at least how to convert the day (1-Nov) to day. I will use current year (2013) or next year (2014) for now.
You may usefull following links. you can start from here and then can analyse there codes.
link 1 link 2
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
iam trying to make a quote of the da each day displays a new quote from dataBase selected sequentially depending on date , which mean i will put 365 Quote and i expect each day displays a new Quote ..
You need to store all the quotes in database with specific display date.
then just compare date of today with database date and display the Quotes. DONE.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
What I'm trying to do is get some activities from an activity calendar that fall within the current week to create a widget that shows activities for the current week. Now how could I do such a thing with PHP/MySQL? Each database row has a date field.
This is the structure of the db table I'm working with:
I hope my question is clear and I hope someone will be able to help me out.
Use YEARWEEK() function: WHERE YEARWEEK(NOW()) = YEARWEEK(datum)
select foo, bar from mytable where STR_TO_DATE(datum, '%Y/%m/%d') > (CURDATE() - INTERVAL 7 DAYS);
EDIT: add string to date conversion as original field is a varchar.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
(I can't imagine how this question is off-topic, it is only asking about a regex just like a dozen questions on stackoverflow !!!!!!!!!)
In order to find a solution to the question User-friendly URLs for user profiles in YaF
one way of solving it is by finding a regex to capture anything else other than the predefined list of controllers,
So I need a regex to match this /notAcontroller where notAcontroller is not one of my predefined controllers like in this array [index, home, profile]
Example:
For these controllers [index, home, profile]
I need to match for strings like these: /Joan, /abdelhady/photos
but not these: /profile/get/id/222, /index or even /
Use a negative look ahead anchored to start:
^/(?!(index|home|profile)$).*
See a live demo