Here you can find the source of getNodeValueAsDate(Node node)
Parameter | Description |
---|---|
node | Description of the Parameter |
public final static Date getNodeValueAsDate(Node node) throws DOMException, ParseException
//package com.java2s; /**//from w ww . j a v a2s . com * Copyright (c) 1999-2007, Fiorano Software Technologies Pvt. Ltd. and affiliates. * Copyright (c) 2008-2015, Fiorano Software Pte. Ltd. and affiliates. * * All rights reserved. * * This software is the confidential and proprietary information * of Fiorano Software ("Confidential Information"). You * shall not disclose such Confidential Information and shall use * it only in accordance with the terms of the license agreement * enclosed with this product or entered into with Fiorano. */ import org.w3c.dom.*; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; public class Main { /** * Gets the node value as date. * *@param node Description of the Parameter *@return The nodeValueAsDate value *@exception DOMException Description of the Exception *@exception ParseException Description of the Exception */ public final static Date getNodeValueAsDate(Node node) throws DOMException, ParseException { if (node == null) return null; NamedNodeMap attrs = node.getAttributes(); Node attr = attrs.getNamedItem("DateTimeFormat"); // Date format String format = attr.getNodeValue().trim(); node = node.getFirstChild(); if (node != null) { String date = node.getNodeValue().trim(); DateFormat df = new SimpleDateFormat(format); return df.parse(date); } return null; } }