-1

How to convert a string, for instance

$datestring = '28.08.14 10.42';

To a new format like date("YmdHis.u")

Thank you

boby lapointe
  • 535
  • 1
  • 5
  • 14

2 Answers2

1

Use date function. There is no such format as what you have required but the what I think you want to achieve is this.

DEMO

<?php

$datestring = '28.08.14 10.42';

$date = date("Y-m-d H:i:s:u", strtotime($datestring));
echo $date; //outputs 2014-08-28 10:42:00:000000

?>
John Robertson
  • 1,486
  • 13
  • 16
0

Try this

$datestring = '28.08.14 10.42';
echo date("YmdHis.u",strtotime($datestring));
웃웃웃웃웃
  • 11,829
  • 15
  • 59
  • 91