Your Ad Here

Posted By

theroamingcoder on 05/04/10


Tagged


Versions (?)

Java create PHP timestamp


 / Published in: Java
 

This specific snippet was for converting a sqlserver database export to a MySQL database where PHP timestamps from time() are used.

  1. public static long GenerateTimestamp(String s){
  2. try{
  3. //07/06/01 12:00 AM
  4. SimpleDateFormat format = new SimpleDateFormat("MM/dd/yy hh:mm a");
  5. Date d = format.parse(s);
  6. return (d.getTime()/1000);
  7. }
  8. catch(Exception ex){
  9. return 0;
  10. }
  11. }

Report this snippet  

You need to login to post a comment.