Parses a GPS timestamp with a 1 second precision.
@param gpsTimestamp String containing time stamp
@return A date, precise to the second, representing the given timestamp.
@throws Exception
506176
static public Date parseGpsTimestamp(String gpsTimestamp) throws Exception {
		try {
			Matcher matcherTime = patternTime.matcher(gpsTimestamp);
			if( matcherTime.matches() ) {
				int year = Integer.parseInt( matcherTime.group(1) );
				int month = Integer.parseInt( matcherTime.group(2) );
				int day = Integer.parseInt( matcherTime.group(3) );
				int hour = Integer.parseInt( matcherTime.group(4) );
				int min = Integer.parseInt( matcherTime.group(5) );
				int sec = Integer.parseInt( matcherTime.group(6) );

				GregorianCalendar cal = new GregorianCalendar(year, month-1, day, hour, min, sec);
				cal.setTimeZone( new SimpleTimeZone(SimpleTimeZone.UTC_TIME, "UTC") );
				Date date = cal.getTime();

				return date;
			}
			
			throw new Exception("Unrecognizd GPS timestamp: "+gpsTimestamp);

		} catch (Exception e) {
			throw new Exception("Error parsing GPS  timestamp", e);
		}
	}
1201641
public static java.sql.Timestamp toTimestamp(Object value) throws ParseException {
        if (value == null) {
            return null;
        }
        if (value instanceof java.sql.Timestamp) {
            return (java.sql.Timestamp) value;
        }
        if (value instanceof String) {

            if ("".equals((String) value)) {
                return null;
            }
            return new java.sql.Timestamp(IN_TIMESTAMP_FORMAT.parse((String) value).getTime());
        }

        return new java.sql.Timestamp(IN_TIMESTAMP_FORMAT.parse(value.toString()).getTime());
    }
786283
public void setTimestamp(String timestamp) throws ParseException {
        this.analysisTimestamp = new SimpleDateFormat(TIMESTAMP_FORMAT, Locale.ENGLISH).parse(timestamp);
    }
773532
@Override
    public void setTimestamp(String parameterName, Timestamp x) throws SQLException
    {
        checkClosed();
        throw SQLError.noSupport();
    }
584689
public static Long toTimestamp(String dateStr, String format, TimeZone tz) {
		SimpleDateFormat formatter = FORMATTER_CACHE.get(format);
		formatter.setTimeZone(tz);
		try {
			return formatter.parse(dateStr).getTime();
		} catch (ParseException e) {
			return null;
		}
	}
1283319
public static Date parseBasicTimestamp(String value) throws ParseException
   {
      Date result = null;

      if (value.length() > 0)
      {
         if (!value.equals("-1 -1") && !value.equals("0"))
         {
            DateFormat df;
            if (value.endsWith(" 0"))
            {
               df = DATE_FORMAT1.get();
            }
            else
            {
               if (value.indexOf(' ') == -1)
               {
                  df = DATE_FORMAT2.get();
               }
               else
               {
                  df = TIMESTAMP_FORMAT.get();
                  int timeIndex = value.indexOf(' ') + 1;
                  if (timeIndex + 6 > value.length())
                  {
                     String time = value.substring(timeIndex);
                     value = value.substring(0, timeIndex) + "0" + time;
                  }
               }
            }

            result = df.parse(value);
         }
      }

      //System.out.println(value + "=>" + result);
      return result;
   }
472989
public static String getTimestamp(Date time) {
        return getTimestampFormatter().format(time == null ? new Date() : time);
    }
358335
@Override
  public long getNextIncludedTime (final long nTimeStamp)
  {

    // Call base calendar implementation first
    long timeStamp = nTimeStamp;
    final long baseTime = super.getNextIncludedTime (timeStamp);
    if ((baseTime > 0) && (baseTime > timeStamp))
    {
      timeStamp = baseTime;
    }

    // Get timestamp for 00:00:00
    final Calendar day = getStartOfDayJavaCalendar (timeStamp);
    while (isTimeIncluded (day.getTime ().getTime ()) == false)
    {
      day.add (Calendar.DATE, 1);
    }

    return day.getTime ().getTime ();
  }
732342
public function getCreatedAtTimestamp(): ?int
    {
        if (!$this->hasCreatedAt()) {
            return null;
        }

	    $timestamp = strtotime($this->getCreatedAt() . 'UTC');

	    if ($timestamp === false) {
		    throw new Exception("Unable to get timestamp from \"{$this->getCreatedAt()}\"");
	    }

	    return $timestamp;
    }
1106105
public static boolean isExactEarthTimestamp(String line) {
		try {
			new NmeaMessageExactEarthTimestamp(line);
			return true;
		} catch (AisParseException e) {
			return false;
		} catch (NmeaMessageParseException e) {
			return false;
		}
	}
1029299
public Date getTimestamp(FastTrackField dateName, FastTrackField timeName)
   {
      Date result = null;
      Date date = getDate(dateName);
      if (date != null)
      {
         Calendar dateCal = DateHelper.popCalendar(date);
         Date time = getDate(timeName);
         if (time != null)
         {
            Calendar timeCal = DateHelper.popCalendar(time);
            dateCal.set(Calendar.HOUR_OF_DAY, timeCal.get(Calendar.HOUR_OF_DAY));
            dateCal.set(Calendar.MINUTE, timeCal.get(Calendar.MINUTE));
            dateCal.set(Calendar.SECOND, timeCal.get(Calendar.SECOND));
            dateCal.set(Calendar.MILLISECOND, timeCal.get(Calendar.MILLISECOND));
            DateHelper.pushCalendar(timeCal);
         }

         result = dateCal.getTime();
         DateHelper.pushCalendar(dateCal);
      }

      return result;
   }
620210
public static Timestamp parseTimestamp(final String date, final String format, final TimeZone timeZone) {
        if (N.isNullOrEmpty(date) || (date.length() == 4 && "null".equalsIgnoreCase(date))) {
            return null;
        }

        return createTimestamp(parse(date, format, timeZone));
    }
942893
def parse_timestamp(timestamp):
    """"""
    dt = dateutil.parser.parse(timestamp)
    return dt.astimezone(dateutil.tz.tzutc())
183331
private String getFormattedTimestamp(int offset) {
        SimpleDateFormat df = new SimpleDateFormat(
                "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
        df.setTimeZone(TimeZone.getTimeZone("UTC"));

        if (overriddenDate != null) {
            return df.format(overriddenDate);
        } else {
            return df.format(getSignatureDate(offset));
        }
    }
188077
public static final synchronized Date parseTime(String time) {
		try {
			return timeFormat.parse(time);
		} catch(ParseException e) {
			throw new RuntimeException(e);
		}
	}
777980
public static DateTime parseTime(String timeString) {
		timeString = normalize(timeString);
		return parse(timeString, DatePattern.NORM_TIME_FORMAT);
	}
440833
public String getTimestamp() {
        return (data != null && data.payload != null) ? data.payload.timestamp : null;
    }