Cep Posted October 3, 2006 Share Posted October 3, 2006 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? Link to comment https://forums.phpfreaks.com/topic/22851-format-a-date/ Share on other sites More sharing options...
kenrbnsn Posted October 3, 2006 Share Posted October 3, 2006 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 Link to comment https://forums.phpfreaks.com/topic/22851-format-a-date/#findComment-102955 Share on other sites More sharing options...
Cep Posted October 3, 2006 Author Share Posted October 3, 2006 Aha! I was using the wrong format function then, needed strtotime. Thanks Ken! Link to comment https://forums.phpfreaks.com/topic/22851-format-a-date/#findComment-102959 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.