0

How do i convert

$time = "31-08-2013T14:00";

to

$time = "Sa, 14:00" #sa for saturday

i have tried the following:

$time = date("D H:i", $time);

but this does not work. Can anybody help me?

sn0ep
  • 3,843
  • 8
  • 39
  • 63

1 Answers1

2

Try with strtotime

$time = date("D H:i", strtotime($time));

You need to convert the $time to string

GautamD31
  • 28,552
  • 10
  • 64
  • 85
  • Wow, someone's quick on the buzzer. +1 :) – Fluffeh Aug 31 '13 at 12:18
  • Another thing can i convert the Day name like Wed to my personal Locale? which is Woe – sn0ep Aug 31 '13 at 12:19
  • @Gautam3164: Please, Please, Please step away answering PHP date-time quesitons that are easily solve-able with `strtotime`. Thanks a lot. You know, it's just the case we have a massive over-amount of PHP date-time questions on site already and it is really important to find a good duplicate and close against instead of giving another the same answer. – hakre Aug 31 '13 at 12:20
  • Thanku @hakre.Iam not only answering date-time questions.Iam answering which I can – GautamD31 Aug 31 '13 at 12:21
  • @Gautam3164: I can also understand that you fear there could be other users that would answer instead of you and would get the precious points. However, there is great chance taken your knowledge that you are able to answer questions others can't, why not prefer harder nuts? – hakre Aug 31 '13 at 12:22
  • Yes You can see my answers which I have given previous... – GautamD31 Aug 31 '13 at 12:22
  • @Gautam3164: Okay, here is the deal: if you find a new date-time question and you can't find the duplicate, ping me. Because if the question has never been asked before, I give you (next to the one who asks it) a 500 bounty. But you will get that bonus only if you now stop to answer duplicate date-time questions in the PHP tag. Deal? Also please delete this answer. – hakre Aug 31 '13 at 12:23
  • You know I have already marked it `close` – GautamD31 Aug 31 '13 at 12:24