Th3Alchemist
Th3Alchemist

Reputation: 1181

Convert european time format to timestamp

What is the most efficient way to convert a given European formatted date (DD/MM/YY) to the correct timestamp?

Example: 10/11/12 should output 1352505600 as the 10th November 2012, and not the October 11th 2012

Upvotes: 1

Views: 2688

Answers (3)

John Conde
John Conde

Reputation: 219814

DateTime::createFromFormat()

$date = DateTime::createFromFormat('d/m/y', $eu_date);
echo $date->format("U");

Upvotes: 3

PeaceDealer
PeaceDealer

Reputation: 1017

Use the 2nd optional variable to the date function to feed it the unix timestamp

Upvotes: 0

Related Questions