Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

converting dates

Status
Not open for further replies.

manicleek

Technical User
Jun 16, 2004
143
GB
how can I change a date in the format 25-12-2005 into a timestamp and vice versa?
 
if I use

$date = "25-12-2005";

$stamp = strtotime($date);

it makes a timestamp of 1937689200

which is 28-05-2031
 
the date is being entered into a form though, in the format dd-mm-yyyy
 
I would use explode() to split the string at the dashes into an array. I would then use string concatenation (the "." operator) to put the string back together from the parts.

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top