0

I use API of service which return me c# DateTime string: /Date(1327914214000+0400)/ And i should convert it to unixstamp, because i use php. So how can I do that?

kirugan
  • 2,514
  • 2
  • 22
  • 41

2 Answers2

0

For me the best solution came from here https://stackoverflow.com/a/16749812/469995

strtotime has no effect and I don't even understand why it's a correct answer without preparing the parameter to send to strtotime

Community
  • 1
  • 1
Sylvain RayƩ
  • 2,456
  • 16
  • 23
0

PHP's [strtotime][1] function is perfect for this. It can handle most common date formats, including strings.

Another option is with MySQL functions FROM_UNIXTIME and UNIX_TIMESTAMP

SELECT UNIX_TIMESTAMP(datetime_column) FROM table

This usually is faster than a PHP function call.

Sabari
  • 6,205
  • 1
  • 27
  • 36