So, I'm totally new at PHP and Drupal, so if this is a newbish question, I completely acknowledge the fact. However, I do need some help, so anything would be appreciated.
Currently, I'm working on this snippet of code:
$article_date = $matches;
$article_timestamp =date('Y-m-d', strtotime($matches));
drupal_set_message(t("Article timestamp: ".$article_timestamp));
drupal_set_message(t("date content: ".$matches));
The general code takes an .xml file and searches for this: <date>2012-09-21</date>
This the preg_match statement.
What I'm trying to do with drupal is have the article that's being posted to a drupal run website is
$node->created = $article_timestamp;
But it outputs: 1969-12-31
This is -1 in unix time, the moment before the Unix epoch began. I set $article_timestamp to -1 just to check.
Why is it doing this? I'm trying to have the article authored on the date it was posted, but I can't figure out how. Another variant is setting $article_timestamp = strtotime($matches) but that sets the date to the current day.
What is weird is that if I do this:
$article_timestamp = strtotime($fixed_date);
drupal_set_message(t("from fixed to variable:".$article_timestamp));
It works properly. If someone could help me out, I'd really appreciate it. And if you need any more info, I'll be glad to give it.