AT&T Home | AT&T Labs | Research
AT&T Labs, Inc. - Research

The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YChart | YDAT | YWAIT | Byzgraf | FAQs
parseDate ([Locale lc [, TimeZone tz],] String dateStr [, String format]) yoix.util
 
Parses the dateStr according to the supplied format or the default format, and returns the corresponding number of seconds since zero hour GMT of January 1, 1970. When supplied, tz overrides the default timezone information and lc provides locale-specific information that overrides the default format, "EEE MMM dd HH:mm:ss zzz yyyy". The format specification is given by the following components:
G Text: era (e.g., AD)
y Number: year (e.g., 1999)
M Text or Number: month of year (e.g., November or 11)
d Number: day of month (e.g., 14)
h Number: hour as 12-hour clock (e.g., 10)
H Number: hour as 24-hour clock (e.g., 22)
m Number: minute of hour (e.g., 32)
s Number: second of minute (e.g., 23)
S Number: millisecond of second (e.g., 360)
E Text: day of week (e.g., Sunday)
D Number: day of year (e.g., 234)
F Number: occurrence of day of week in month (e.g., 1, which might mean the first Monday in September).
w Number: week of year (e.g., 49)
W Number: week of month (e.g., 2, which might mean that Sunday July 2 is in the second week of July where a week runs from Sunday to Saturday)
a Text: am/pm indicator (e.g., PM)
k Number: equivalent to the number given by format H plus one (e.g., 24)
K Number: equivalent to the number given by format h minus one (e.g., 0)
z Text: time zone (e.g., EasternDaylightTime)
' Delimiter: escape for text (e.g., 'The time now is: ')
'' Literal: single quote
Any characters in format that are not in the ranges of [a-z] and [A-Z] will be treated as single-quoted text.
 
 Example:   A simple date parsing example is:
import yoix.util.*;
import yoix.stdio.printf;

String infamy = "December 7, 1941";
printf("%s = %d\n", infamy, parseDate(infamy, "MMM dd, yyyy"));
yields:
December 7, 1941 = -885754800
 
 Return:   double
 
 See Also:   currentTimeMillis, date, nanoTime, parseTimer, sleep, time, timerFormat

 

Yoix is a registered trademark of AT&T Inc.