Here you can find the source of parseTimeString(String time)
public static long parseTimeString(String time)
//package com.java2s; /**//w ww . j a v a 2 s . c o m * Project: play-jetty-server * * File Created at 2014-4-12 * $Id$ * * Copyright 2010 dianping.com. * All rights reserved. * * This software is the confidential and proprietary information of * Dianping Company. ("Confidential Information"). You shall not * disclose such Confidential Information and shall use it only in * accordance with the terms of the license agreement you entered into * with dianping.com. */ import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { private static DateFormat formatter = new SimpleDateFormat("yyyy/MM/DD|HH:mm"); public static long parseTimeString(String time) { Date date; try { date = formatter.parse(time); return date.getTime(); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } return 0; } }