dateparse.js revision 877:cf4d2252d444
124139Sjoerg/* 224139Sjoerg * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 324139Sjoerg * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 424139Sjoerg * 524139Sjoerg * This code is free software; you can redistribute it and/or modify it 624139Sjoerg * under the terms of the GNU General Public License version 2 only, as 724139Sjoerg * published by the Free Software Foundation. 824139Sjoerg * 924139Sjoerg * This code is distributed in the hope that it will be useful, but WITHOUT 1066641Simp * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1166641Simp * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1224139Sjoerg * version 2 for more details (a copy is included in the LICENSE file that 1324139Sjoerg * accompanied this code). 1424139Sjoerg * 1524139Sjoerg * You should have received a copy of the GNU General Public License version 1624139Sjoerg * 2 along with this work; if not, write to the Free Software Foundation, 1724139Sjoerg * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1824139Sjoerg * 1924139Sjoerg * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2024139Sjoerg * or visit www.oracle.com if you need additional information or have any 2124139Sjoerg * questions. 2224139Sjoerg */ 2324139Sjoerg 2424139Sjoerg/** 2524139Sjoerg * Basic checks for Date.parse function. 2624139Sjoerg * 2724139Sjoerg * @test 2824139Sjoerg * @option -timezone=Asia/Calcutta 2924139Sjoerg * @run 3024139Sjoerg */ 3124139Sjoerg 3224139Sjoerg// ISO format 3324139Sjoergvar d = new Date(Date.parse("1972-06-16T00:00:00.000Z")); 3441943Sobrienprint(d.toString()); 3524139Sjoergprint(d.toUTCString()); 3624139Sjoerg 3724139Sjoerg// simple Date 3824139Sjoergd = new Date(Date.parse("2009-01-01")); 3924139Sjoergprint(d.toString()); 4024139Sjoergprint(d.toUTCString()); 4124139Sjoerg 4224139Sjoerg// simple date and make sure we can parse back toString, toISOString 4324139Sjoerg// and toUTCString output .. 4424139Sjoergd = new Date(2011, 4, 11); 4524139Sjoergd = new Date(Date.parse(d.toString())); 4624139Sjoergprint(d.toString()); 4724139Sjoergprint(d.toUTCString()); 4824139Sjoerg 4924139Sjoergd = new Date(Date.parse(d.toISOString())); 5024139Sjoergprint(d.toString()); 5124139Sjoergprint(d.toUTCString()); 5224139Sjoerg 5324139Sjoergd = new Date(Date.parse(d.toUTCString())); 5424139Sjoergprint(d.toString()); 5524139Sjoergprint(d.toUTCString()); 5624139Sjoerg