Jump to content

Archived

This topic is now archived and is closed to further replies.

Cep

Format a date

Recommended Posts

Hello, I am pulling a date field from an Access database and displaying it within a text box on my form.

The format the information is currently in is, 2005-11-07 00:00:00.

I need to display this date as 07/11/2005 (D M Y)

I have looked at the strftime function and it doesnt appear to work, I just keep getting a different combination of 01/01/1970.

How can I change this so that it displays correctly?

Share this post


Link to post
Share on other sites
Use a combination of strtotime() and date():
[code]<?php
$date_str = '2005-11-07 00:00:00';
echo date('d/m/Y',strtotime($date_str));
?>[/code]

Ken

Share this post


Link to post
Share on other sites
Aha! I was using the wrong format function then, needed strtotime. Thanks Ken!

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.