ucar.nc2.time.CalendarDateFormatter Java Examples
The following examples show how to use
ucar.nc2.time.CalendarDateFormatter.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DecoderWrapper.java From sis with Apache License 2.0 | 6 votes |
/** * Returns the value of the attribute of the given name as a date, or {@code null} if none. * * @param name the name of the attribute to search, or {@code null}. * @return the attribute value, or {@code null} if none or unparsable or if the given name was null. */ @Override public Date dateValue(final String name) { if (name != null) { for (final Group group : groups) { final Attribute attribute = findAttribute(group, name); if (attribute != null && attribute.isString()) { String value = Utils.nonEmpty(attribute.getStringValue()); if (value != null) { final CalendarDate date; try { date = CalendarDateFormatter.isoStringToCalendarDate(Calendar.proleptic_gregorian, value); } catch (IllegalArgumentException e) { listeners.warning(e); continue; } return new Date(date.getMillis()); } } } } return null; }
Example #2
Source File: DefaultDateRangeTest.java From tds with BSD 3-Clause "New" or "Revised" License | 6 votes |
@SpringJUnit4ParameterizedClassRunner.Parameters public static List<Object[]> getTestParameters() { CalendarDate now = CalendarDate.present(); CalendarDate dayAfter = now.add(CalendarPeriod.of(1, CalendarPeriod.Field.Day)); CalendarDate dayBefore = now.add(CalendarPeriod.of(-1, CalendarPeriod.Field.Day)); String nowStr = CalendarDateFormatter.toDateTimeStringISO(now); String dayAfterStr = CalendarDateFormatter.toDateTimeStringISO(dayAfter); String dayBeforeStr = CalendarDateFormatter.toDateTimeStringISO(dayBefore); return Arrays .asList(new Object[][] {{0L, null, "present", "present", null}, {86400L, null, "present", dayAfterStr, null}, {86400L, null, dayBeforeStr, "present", null}, {86400L * 2, null, dayBeforeStr, dayAfterStr, null}, {86400L * 3, null, nowStr, null, "P3D"}, {86400L * 2, null, null, dayBeforeStr, "P2D"}}); }
Example #3
Source File: PointSubsetWriterCSV.java From tds with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void writePoint(PointFeature pointFeat) throws IOException { EarthLocation loc = pointFeat.getLocation(); writer.print(CalendarDateFormatter.toDateTimeStringISO(pointFeat.getObservationTimeAsCalendarDate())); writer.print(','); writer.print(Format.dfrac(loc.getLatitude(), 3)); writer.print(','); writer.print(Format.dfrac(loc.getLongitude(), 3)); StructureData structureData = pointFeat.getDataAll(); for (VariableSimpleIF wantedVar : wantedVariables) { writer.print(','); Array dataArray = structureData.getArray(wantedVar.getShortName()); writer.print(dataArray.toString().trim()); } writer.println(); }
Example #4
Source File: StationSubsetWriterCSV.java From tds with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override protected void writeStationPointFeature(StationPointFeature stationPointFeat) throws IOException { Station station = stationPointFeat.getStation(); writer.print(CalendarDateFormatter.toDateTimeStringISO(stationPointFeat.getObservationTimeAsCalendarDate())); writer.print(','); writer.print(station.getName()); writer.print(','); writer.print(Format.dfrac(station.getLatitude(), 3)); writer.print(','); writer.print(Format.dfrac(station.getLongitude(), 3)); for (VariableSimpleIF wantedVar : wantedVariables) { writer.print(','); Array dataArray = stationPointFeat.getDataAll().getArray(wantedVar.getShortName()); writer.print(dataArray.toString().trim()); } writer.println(); }
Example #5
Source File: CFPointWriter.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 6 votes |
public void finish() throws IOException { if (llbb != null) { writer.updateAttribute(null, new Attribute(ACDD.LAT_MIN, llbb.getLowerLeftPoint().getLatitude())); writer.updateAttribute(null, new Attribute(ACDD.LAT_MAX, llbb.getUpperRightPoint().getLatitude())); writer.updateAttribute(null, new Attribute(ACDD.LON_MIN, llbb.getLowerLeftPoint().getLongitude())); writer.updateAttribute(null, new Attribute(ACDD.LON_MAX, llbb.getUpperRightPoint().getLongitude())); } if (!noTimeCoverage) { if (minDate == null) minDate = CalendarDate.present(); if (maxDate == null) maxDate = CalendarDate.present(); writer.updateAttribute(null, new Attribute(ACDD.TIME_START, CalendarDateFormatter.toDateTimeStringISO(minDate))); writer.updateAttribute(null, new Attribute(ACDD.TIME_END, CalendarDateFormatter.toDateTimeStringISO(maxDate))); } writer.close(); }
Example #6
Source File: RecordDatasetHelper.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 6 votes |
private double getTime(StructureMembers.Member timeVar, StructureData sdata) { if (timeVar == null) return 0.0; if ((timeVar.getDataType() == DataType.CHAR) || (timeVar.getDataType() == DataType.STRING)) { String time = sdata.getScalarString(timeVar); CalendarDate date = CalendarDateFormatter.isoStringToCalendarDate(null, time); if (date == null) { log.error("Cant parse date - not ISO formatted, = " + time); return 0.0; } return date.getMillis() / 1000.0; } else { return sdata.convertScalarDouble(timeVar); } }
Example #7
Source File: NestedTable.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 6 votes |
private double getTime(CoordVarExtractor cve, StructureData[] tableData) { if (cve == null) return Double.NaN; if (tableData[cve.nestingLevel] == null) return Double.NaN; if (cve.isString()) { String timeString = timeVE.getCoordValueString(tableData); CalendarDate date = CalendarDateFormatter.isoStringToCalendarDate(null, timeString); if (date == null) { log.error("Cant parse date - not ISO formatted, = " + timeString); return 0.0; } return date.getMillis(); } else { return cve.getCoordValue(tableData); } }
Example #8
Source File: FileCacheARC.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Show individual cache entries, add to formatter. * * @param format add to this */ @Override public void showCache(Formatter format) { ArrayList<CacheElement.CacheFile> allFiles = new ArrayList<>(files.size()); for (CacheElement elem : cache.values()) { allFiles.addAll(elem.list); } Collections.sort(allFiles); // sort so oldest are on top format.format("%nFileCacheARC %s (min=%d softLimit=%d hardLimit=%d scour=%d):%n", name, minElements, softLimit, hardLimit, period); format.format("isLocked accesses lastAccess location %n"); for (CacheElement.CacheFile file : allFiles) { String loc = file.ncfile != null ? file.ncfile.getLocation() : "null"; CalendarDate cd = CalendarDate.of(file.getLastAccessed()); format.format("%8s %9d %s %s %n", file.isLocked, file.getCountAccessed(), CalendarDateFormatter.toTimeUnits(cd), loc); } showStats(format); }
Example #9
Source File: WriterCFPointAbstract.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 6 votes |
public void finish() throws IOException { if (llbb != null) { writer.updateAttribute(null, new Attribute(ACDD.LAT_MIN, llbb.getLowerLeftPoint().getLatitude())); writer.updateAttribute(null, new Attribute(ACDD.LAT_MAX, llbb.getUpperRightPoint().getLatitude())); writer.updateAttribute(null, new Attribute(ACDD.LON_MIN, llbb.getLowerLeftPoint().getLongitude())); writer.updateAttribute(null, new Attribute(ACDD.LON_MAX, llbb.getUpperRightPoint().getLongitude())); } if (!config.isNoTimeCoverage()) { if (minDate == null) minDate = CalendarDate.present(); if (maxDate == null) maxDate = CalendarDate.present(); writer.updateAttribute(null, new Attribute(ACDD.TIME_START, CalendarDateFormatter.toDateTimeStringISO(minDate))); writer.updateAttribute(null, new Attribute(ACDD.TIME_END, CalendarDateFormatter.toDateTimeStringISO(maxDate))); } writer.close(); }
Example #10
Source File: FileCache.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Show individual cache entries, add to formatter. * * @param format add to this */ @Override public void showCache(Formatter format) { ArrayList<CacheElement.CacheFile> allFiles = new ArrayList<>(files.size()); for (CacheElement elem : cache.values()) { synchronized (elem) { allFiles.addAll(elem.list); } } Collections.sort(allFiles); // sort so oldest are on top format.format("%nFileCache %s (min=%d softLimit=%d hardLimit=%d scour=%d secs):%n", name, minElements, softLimit, hardLimit, period / 1000); format.format(" isLocked accesses lastAccess location %n"); for (CacheElement.CacheFile file : allFiles) { String loc = file.ncfile != null ? file.ncfile.getLocation() : "null"; format.format("%8s %9d %s == %s %n", file.isLocked, file.countAccessed, CalendarDateFormatter.toDateTimeStringISO(file.lastAccessed), loc); } showStats(format); }
Example #11
Source File: VariableTable.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * */ DateRenderer() { oldForm = new CalendarDateFormatter("yyyy-MM-dd HH:mm:ss", CalendarTimeZone.UTC); newForm = new CalendarDateFormatter("dd MMM HH:mm:ss", CalendarTimeZone.UTC); CalendarDate now = CalendarDate.present(); cutoff = now.add(-1, CalendarPeriod.Field.Year); // "now" time format within a year }
Example #12
Source File: DateType.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Same as CalendarDateFormatter.toDateTimeStringISO * * @return formatted date */ public String toDateTimeString() { if (isPresent()) return CalendarDateFormatter.toDateTimeStringISO(new Date()); else return CalendarDateFormatter.toDateTimeStringISO(date); }
Example #13
Source File: Fmrc2Panel.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 5 votes |
private void showGridInv(GridBean bean) { Formatter out = new Formatter(); FmrcInv.UberGrid ugrid = bean.grid; out.format("Show FmrcInv.UberGrid name= %s%n% 3d expected inventory %n%n", ugrid.getName(), ugrid.countExpected()); // show actual inventory TimeCoord union = ugrid.getUnionTimeCoord(); // int w = union.isInterval() ? 4 : 6; int w2 = union.isInterval() ? 9 : 6; out.format(" "); for (int i = 0; i < union.getNCoords(); i++) out.format("%" + w2 + "d ", i); out.format("%n"); out.format(" RunTime Total "); showCoords(union, out); out.format("%n"); int count = 0; int runidx = 0; for (FmrInv.GridVariable run : ugrid.getRuns()) { for (GridDatasetInv.Grid inv : run.getInventory()) { out.format(" %3d %s ", runidx, CalendarDateFormatter.toDateTimeString(run.getRunDate())); count += showActualInventory(inv, union, w2, out); out.format(" %s%n", inv.getLocation()); } runidx++; } out.format("%n%3d counted inventory%n%n%n", count); lite.showGridInfo(ugrid.getName(), out); infoTA.setText(out.toString()); infoWindow.show(); }
Example #14
Source File: StructureTable.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 5 votes |
DateRenderer() { oldForm = new CalendarDateFormatter("yyyy MMM dd HH:mm", CalendarTimeZone.UTC); newForm = new CalendarDateFormatter("MMM dd, HH:mm", CalendarTimeZone.UTC); CalendarDate now = CalendarDate.present(); cutoff = now.add(-1, CalendarPeriod.Field.Year); // "now" time format within a year }
Example #15
Source File: NcssParamsBean.java From tds with BSD 3-Clause "New" or "Revised" License | 5 votes |
public CalendarDate getRequestedDate(Calendar cal) { if (date == null) return null; if (cal.equals(Calendar.getDefault())) return date; // otherwise must reparse return CalendarDateFormatter.isoStringToCalendarDate(cal, getTime()); }
Example #16
Source File: NcssGridParamsBean.java From tds with BSD 3-Clause "New" or "Revised" License | 5 votes |
public CalendarDate getRuntimeDate(Calendar cal) { if (runtimeDate == null) return null; if (cal.equals(Calendar.getDefault())) return runtimeDate; // otherwise must reparse if (getTime().equalsIgnoreCase("present")) { return CalendarDate.present(cal); } return CalendarDateFormatter.isoStringToCalendarDate(cal, getRuntime()); }
Example #17
Source File: StationSubsetWriterXML.java From tds with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override protected void writeStationPointFeature(StationPointFeature stationPointFeat) throws XMLStreamException, IOException { Station station = stationPointFeat.getStation(); staxWriter.writeCharacters("\n "); staxWriter.writeStartElement("stationFeature"); staxWriter.writeAttribute("date", CalendarDateFormatter.toDateTimeStringISO(stationPointFeat.getObservationTimeAsCalendarDate())); staxWriter.writeCharacters("\n "); staxWriter.writeStartElement("station"); staxWriter.writeAttribute("name", station.getName()); staxWriter.writeAttribute("latitude", Format.dfrac(station.getLatitude(), 3)); staxWriter.writeAttribute("longitude", Format.dfrac(station.getLongitude(), 3)); if (!Double.isNaN(station.getAltitude())) staxWriter.writeAttribute("altitude", Format.dfrac(station.getAltitude(), 0)); if (station.getDescription() != null) staxWriter.writeCharacters(station.getDescription()); staxWriter.writeEndElement(); for (VariableSimpleIF wantedVar : wantedVariables) { staxWriter.writeCharacters("\n "); staxWriter.writeStartElement("data"); staxWriter.writeAttribute("name", wantedVar.getShortName()); if (wantedVar.getUnitsString() != null) staxWriter.writeAttribute(CDM.UNITS, wantedVar.getUnitsString()); Array dataArray = stationPointFeat.getDataAll().getArray(wantedVar.getShortName()); String ss = dataArray.toString(); Class elemType = dataArray.getElementType(); if ((elemType == String.class) || (elemType == char.class) || (elemType == StructureData.class)) ss = ucar.nc2.util.xml.Parse.cleanCharacterData(ss); // make sure no bad chars staxWriter.writeCharacters(ss.trim()); staxWriter.writeEndElement(); } staxWriter.writeCharacters("\n "); staxWriter.writeEndElement(); }
Example #18
Source File: PointSubsetWriterXML.java From tds with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void writePoint(PointFeature pointFeat) throws XMLStreamException, IOException { EarthLocation loc = pointFeat.getLocation(); staxWriter.writeCharacters("\n "); staxWriter.writeStartElement("pointFeature"); staxWriter.writeAttribute("date", CalendarDateFormatter.toDateTimeStringISO(pointFeat.getObservationTimeAsCalendarDate())); staxWriter.writeCharacters("\n "); staxWriter.writeEmptyElement("location"); staxWriter.writeAttribute("latitude", Format.dfrac(loc.getLatitude(), 3)); staxWriter.writeAttribute("longitude", Format.dfrac(loc.getLongitude(), 3)); if (!Double.isNaN(loc.getAltitude())) staxWriter.writeAttribute("altitude", Format.dfrac(loc.getAltitude(), 0)); StructureData structureData = pointFeat.getDataAll(); for (VariableSimpleIF wantedVar : wantedVariables) { staxWriter.writeCharacters("\n "); staxWriter.writeStartElement("data"); staxWriter.writeAttribute("name", wantedVar.getShortName()); if (wantedVar.getUnitsString() != null) staxWriter.writeAttribute(CDM.UNITS, wantedVar.getUnitsString()); Array dataArray = structureData.getArray(wantedVar.getShortName()); String ss = dataArray.toString(); Class elemType = dataArray.getElementType(); if ((elemType == String.class) || (elemType == char.class) || (elemType == StructureData.class)) ss = ucar.nc2.util.xml.Parse.cleanCharacterData(ss); // make sure no bad chars staxWriter.writeCharacters(ss.trim()); staxWriter.writeEndElement(); } staxWriter.writeCharacters("\n "); staxWriter.writeEndElement(); }
Example #19
Source File: TestRegexp.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Test public void testIsoDate() { String p = CalendarDateFormatter.isodatePatternString; // String m = "2012-05-03 10:03:29Z"; String m = "2012-04-27t08:00:00-0600"; testMatch(p, m, true, new String[] {"2012-04-27", "t08:00:00-0600", "08:00:00", "-0600"}); }
Example #20
Source File: DateType.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Same as DateFormatter.toDateOnlyString() * * @return formatted date */ public String toDateString() { if (isPresent()) return CalendarDateFormatter.toDateStringPresent(); else return CalendarDateFormatter.toDateString(date); }
Example #21
Source File: WriterCFPointAbstract.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 5 votes |
private void addNetcdf3UnknownAtts(boolean noTimeCoverage) { // dummy values, update in finish() if (!noTimeCoverage) { CalendarDate now = CalendarDate.of(new Date()); writerb.addAttribute(new Attribute(ACDD.TIME_START, CalendarDateFormatter.toDateTimeStringISO(now))); writerb.addAttribute(new Attribute(ACDD.TIME_END, CalendarDateFormatter.toDateTimeStringISO(now))); } writerb.addAttribute(new Attribute(ACDD.LAT_MIN, 0.0)); writerb.addAttribute(new Attribute(ACDD.LAT_MAX, 0.0)); writerb.addAttribute(new Attribute(ACDD.LON_MIN, 0.0)); writerb.addAttribute(new Attribute(ACDD.LON_MAX, 0.0)); }
Example #22
Source File: FeatureDatasetCapabilitiesWriter.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 5 votes |
public static CalendarDateRange getTimeSpan(Document doc) { Element root = doc.getRootElement(); Element timeSpan = root.getChild("TimeSpan"); if (timeSpan == null) return null; String beginS = timeSpan.getChildText("begin"); String endS = timeSpan.getChildText("end"); // String resS = timeSpan.getChildText("resolution"); if ((beginS == null) || (endS == null)) return null; try { CalendarDate start = CalendarDateFormatter.isoStringToCalendarDate(null, beginS); CalendarDate end = CalendarDateFormatter.isoStringToCalendarDate(null, endS); if ((start == null) || (end == null)) { return null; } CalendarDateRange dr = CalendarDateRange.of(start, end); // LOOK if (resS != null) // dr.setResolution(new TimeDuration(resS)); return dr; } catch (Exception e) { return null; } }
Example #23
Source File: FeatureDatasetCapabilitiesWriter.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 5 votes |
public static CalendarDateRange getTimeSpan(Document doc) { Element root = doc.getRootElement(); Element timeSpan = root.getChild("TimeSpan"); if (timeSpan == null) return null; String beginS = timeSpan.getChildText("begin"); String endS = timeSpan.getChildText("end"); // String resS = timeSpan.getChildText("resolution"); if ((beginS == null) || (endS == null)) return null; try { CalendarDate start = CalendarDateFormatter.isoStringToCalendarDate(null, beginS); CalendarDate end = CalendarDateFormatter.isoStringToCalendarDate(null, endS); if ((start == null) || (end == null)) { return null; } CalendarDateRange dr = CalendarDateRange.of(start, end); // LOOK if (resS != null) // dr.setResolution(new TimeDuration(resS)); return dr; } catch (Exception e) { return null; } }
Example #24
Source File: CFPointWriter.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 5 votes |
private void addNetcdf3UnknownAtts(boolean noTimeCoverage) { // dummy values, update in finish() if (!noTimeCoverage) { CalendarDate now = CalendarDate.of(new Date()); writer.addGroupAttribute(null, new Attribute(ACDD.TIME_START, CalendarDateFormatter.toDateTimeStringISO(now))); writer.addGroupAttribute(null, new Attribute(ACDD.TIME_END, CalendarDateFormatter.toDateTimeStringISO(now))); } writer.addGroupAttribute(null, new Attribute(ACDD.LAT_MIN, 0.0)); writer.addGroupAttribute(null, new Attribute(ACDD.LAT_MAX, 0.0)); writer.addGroupAttribute(null, new Attribute(ACDD.LON_MIN, 0.0)); writer.addGroupAttribute(null, new Attribute(ACDD.LON_MAX, 0.0)); }
Example #25
Source File: MessageDispatchDDS.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 4 votes |
boolean scheduleWrite(Message m) throws IOException { CalendarDate cd = m.ids.getReferenceTime(); String writerName = (dayRollover) ? fileout + "." + CalendarDateFormatter.toDateString(cd) : fileout; // fetch or create the MessageWriter MessageWriter writer = writers.get(writerName); if (writer == null) { try { File file2write; if (useCatSubdirs) { BufrTableLookup lookup = m.getLookup(); // String centerDir = "Center-"+lookup.getCenter()+"."+lookup.getSubCenter(); // File dir1 = new File(dispatchDir, centerDir); // if (!dir1.exists() && !dir1.mkdirs()) logger.warn("Failed to make "+dir1.getPath()); String catDir = "Category-" + lookup.getCategory() + "." + lookup.getSubCategory(); File dir2 = new File(dispatchDir, catDir); if (!dir2.exists() && !dir2.mkdirs()) logger.warn("Failed to make " + dir2.getPath()); String filename = (dayRollover) ? fileout + "." + CalendarDateFormatter.toDateString(cd) : fileout; file2write = new File(dir2, filename + ".bufr"); System.out.printf("Start %s internalTableMessages=%d%n %s%n %s%n", file2write, bufrTableMessages.size(), lookup.getCenterName(), lookup.getCategoryFullName()); } else { file2write = new File(dispatchDir, writerName + ".bufr"); } writer = new MessageWriter(file2write, fileno, bufrTableMessages); System.out.printf("Start %s internalTableMessages=%d%n", file2write, bufrTableMessages.size()); writers.put(writerName, writer); fileno++; } catch (FileNotFoundException e) { e.printStackTrace(); return false; } } writer.write(m); // put it on the write queue if (showMatch) System.out.println("match <" + m.getHeader() + ">"); match++; return true; }
Example #26
Source File: VariableTable.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 4 votes |
/** * */ private void export() { String filename = fileChooser.chooseFilename(); if (filename == null) { return; } CalendarDateFormatter printForm = new CalendarDateFormatter("yyyy-MM-dd HH:mm:ss", CalendarTimeZone.UTC); try (FileOutputStream fos = new FileOutputStream(filename); OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8); PrintWriter pw = new PrintWriter(osw)) { pw.println("; file name : " + fds.getLocation()); if (includeGlobals.isSelected()) { List<Attribute> gAtts = fds.getGlobalAttributes(); for (Attribute a : gAtts) { pw.println("; " + a.toString(false)); } } pw.println("; this file written : " + new Date()); TableModel model = dataModel; for (int col = 0; col < model.getColumnCount(); col++) { if (col > 0) { pw.print(","); } pw.print(model.getColumnName(col)); } pw.println(); for (int row = 0; row < model.getRowCount(); row++) { for (int col = 0; col < model.getColumnCount(); col++) { if (col > 0) { pw.print(","); } Object o = model.getValueAt(row, col); if (o instanceof CalendarDate) { CalendarDate d = (CalendarDate) o; pw.print(printForm.toString(d)); } else { pw.print(o); } } pw.println(); } pw.close(); JOptionPane.showMessageDialog(this, "File successfully written"); } catch (IOException ioe) { JOptionPane.showMessageDialog(this, "ERROR: " + ioe.getMessage()); ioe.printStackTrace(); } fileChooser.save(); }
Example #27
Source File: MFileTable.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 4 votes |
public String getLastModified() { return CalendarDateFormatter.toDateTimeString(new Date(mfile.getLastModified())); }
Example #28
Source File: FileCache.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 4 votes |
public String toString() { String name = ncfile == null ? "ncfile is null" : ncfile.getLocation(); return isLocked + " " + countAccessed + " " + CalendarDateFormatter.toDateTimeStringISO(lastAccessed) + " " + name; }
Example #29
Source File: TimeParamsValidator.java From tds with BSD 3-Clause "New" or "Revised" License | 4 votes |
private static CalendarDate isoString2Date(String isoString) { if ("present".equalsIgnoreCase(isoString)) return CalendarDate.present(); return CalendarDateFormatter.isoStringToCalendarDate(Calendar.getDefault(), isoString); }
Example #30
Source File: CoordinateAxisTimeHelper.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 4 votes |
public CalendarDate makeCalendarDateFromOffset(String offset) { return CalendarDateFormatter.isoStringToCalendarDate(calendar, offset); }