/** * Get time stamp * * @param datecur * @return */ public static long Getticks (String datecur) { Convert the Target-epoch time to a Well-format string String date = new Java.text.SimpleDateFormat ("Yyyy/mm/dd/hh/mm/ss") . Format (New Date (Long.parselong (EPOCHSTR))); SimpleDateFormat SDF = new SimpleDateFormat ("Yyyy/mm/dd/hh/mm/ss"); String datecur = Sdf.format (New Date ()); String[] ds = Datecur.split ("/");
Start of the Ticks time Calendar Calstart = Calendar.getinstance (); /** * The parameters here are very important, in principle, is 1, the date is 2, because the previous date did not lose 1 the third parameter is 1: the date is more than 2 days, 2 is the date more than 1 days * **/ When the upload fails, there will always be confusion and need to find the source to solve Calstart.set (1, 1, 0, 0, 0, 0); Calstart.set (1, 1, 3, 0, 0, 0);
The target time Calendar calend = Calendar.getinstance (); Calend.set (Integer.parseint (Ds[0]), Integer.parseint (Ds[1]), Integer.parseint (ds[2]), Integer.parseint (Ds[3]), Integer.parseint (Ds[4]), Integer.parseint (Ds[5]);
Epoch time of the Ticks-start time Long Epochstart = Calstart.gettime (). GetTime (); Epoch time of the target time Long epochend = Calend.gettime (). GetTime ();
Get the sum of epoch time, from the target time to the Ticks-start Time Long all = Epochend-epochstart; Convert epoch time to ticks time Long ticks = ((all/1000) * 1000000) * 10;
return ticks; } |