CAPH.MISC.TIME
Time is an object which provides various kinds of methods related to time functionality. The main APIs of Time include 'timeFormat', 'timeFormatIso8601' and so on. Using timeFormat method, a user can convert a JavaScript Date instance to a formatted string. Also, using timeFormatIso8601 method, a user can convert a JavaScript Date instance to a ISO8601 time format string.
Contents
Methods
timeFormat | ||
Description | ||
Converts a JavaScript Date instance to a formatted string. | ||
Parameters | ■formatStr - String - Local format. Format string * Format string consists of the following characters. * Day - d : Day of the month, 2 digits with leading zeros. 01 through 31 - D : A string of a day with three letters. "Mon" through "Sun" - j : Day of the month without zero. 1 through 31ek. "Sunday" through "Saturday" - l : (lower case of L) Full string of the day of the week. "Sunday" through "Saturday"rd through 31st - S : The day of the month with st, nd, rd or th suffix. 2 characters. 1st, 2nd, 3rd through 31st - w : Number of the day of the week. 0(Sunday) through 6(Saturday) * Month - F : A string of a month, such as "January" or "March". "January" through "December" - m : Month of 2 digits with zero. 01 through 12s. Jan through Dec - M : Abbreviated string of a month, three letters. Jan through Dec - n : Numeric month, without zero. 1 through 121 - t :Number of days in the month. 28 through 31 * Year - Y : Numeric year, 4 digits. Examples: 1999 through 2011 - y : Numeric year, 2 digits. Examples: 99 through 11 * Time - a : Lowercase AM and PM. am or pm - A : Uppercase AM and PM. AM or PMout zero. 1 through 12 - g : 12-hour format of an hour without zero. 1 through 12 - G : 24-hour format of an hour without zero. 0 through 23 - h : 12-hour format of an hour with zero. 01 through 12 - H : 24-hour format of an hour with zero. 00 through 23 - i : Minutes with zero. 00 through 59 - s : Seconds with zero. 00 through 59 - u : Milliseconds Example: 123456 * Time zone - P : Time difference with colon between hours and minutes. Example: +09:00 for Seoul - O : Time difference in hours Example: +0200 for Seoulest of UTC is always negative, and for those east of UTC is always positive. - Z : Timezone offset in seconds. The offset for timezones west of UTC is always negative, and for those east of UTC is always positive. ■date - Object - JavaScript Date instance to be converted | |
Return | ■String - Time in formatted string | |
Emulator Support | Y | |
SDK Constraint | none | |
Example | ||
var date = new Date(); var timeFormat; timeFormat = caph.misc.Time.timeFormat('Y-m-dTH:i:sP', date); |
timeFormatIso8601 | ||
Description | ||
Converts a JavaScript Date instance to a ISO8601 time format string. | ||
Parameters | ■date - Object - JavaScript Date instance to be converted | |
Return | ■String - Time in formatted string | |
Emulator Support | Y | |
SDK Constraint | none | |
Example | ||
var date = new Date(); var timeFormatAtom; timeFormatAtom = caph.misc.Time.timeFormatIso8601(date); |
timeFormatRfc1036 | ||
Description | ||
Converts a JavaScript Date instance to a RFC1036 time format string. | ||
Parameters | ■date - Object - JavaScript Date instance to be converted | |
Return | ■String - Time in formatted string | |
Emulator Support | Y | |
SDK Constraint | none | |
Example | ||
var date = new Date(); var timeFormatAtom; timeFormatAtom = caph.misc.Time.timeFormatRfc1036(date); |
timeFormatRfc1123 | ||
Description | ||
Converts a JavaScript Date instance to a RFC1123 time format string. | ||
Parameters | ■date - Object - JavaScript Date instance to be converted | |
Return | ■String - Time in formatted string | |
Emulator Support | Y | |
SDK Constraint | none | |
Example | ||
var date = new Date(); var timeFormatAtom; timeFormatAtom = caph.misc.Time.timeFormatRfc1123(date); |
timeFormatRfc2822 | ||
Description | ||
Converts a JavaScript Date instance to a RFC2822 time format string. | ||
Parameters | ■date - Object - JavaScript Date instance to be converted | |
Return | ■String - Time in formatted string | |
Emulator Support | Y | |
SDK Constraint | none | |
Example | ||
var date = new Date(); var timeFormatAtom; timeFormatAtom = caph.misc.Time.timeFormatRfc2822(date); |
timeFormatRfc822 | ||
Description | ||
Converts a JavaScript Date instance to a RFC822 time format string. | ||
Parameters | ■date - Object - JavaScript Date instance to be converted | |
Return | ■String - Time in formatted string | |
Emulator Support | Y | |
SDK Constraint | none | |
Example | ||
var date = new Date(); var timeFormatAtom; timeFormatAtom = caph.misc.Time.timeFormatRfc822(date); |
timeFormatRss | ||
Description | ||
Converts a JavaScript Date instance to a RSS time format string. | ||
Parameters | ■date - Object - JavaScript Date instance to be converted | |
Return | ■String - Time in formatted string | |
Emulator Support | Y | |
SDK Constraint | none | |
Example | ||
var date = new Date(); var timeFormatAtom; timeFormatAtom = caph.misc.Time.timeFormatRss(date); |
timeFormatW3c | ||
Description | ||
Converts a JavaScript Date instance to a W3C time format string. | ||
Parameters | ■date - Object - JavaScript Date instance to be converted | |
Return | ■String - Time in formatted string | |
Emulator Support | Y | |
SDK Constraint | none | |
Example | ||
var date = new Date(); var timeFormatAtom; timeFormatAtom = caph.misc.Time.timeFormatW3c(date); |
timeFormatAtom | ||
Description | ||
Converts a JavaScript Date instance to a ATOM time format string. | ||
Parameters | ■date - Object - JavaScript Date instance to be converted | |
Return | ■String - Time in formatted string | |
Emulator Support | Y | |
SDK Constraint | none | |
Example | ||
var date = new Date(); var timeFormatAtom; timeFormatAtom = caph.misc.Time.timFormatAtom(date); |
getDaysInMonth | ||
Description | ||
Returns the number of days in the month | ||
Parameters | ■year - Number - The message for log ■month - Number - The month for getting days | |
Return | ■Number - the number of Days | |
Emulator Support | Y | |
SDK Constraint | none | |
Example | ||
var days; days = caph.misc.Time.getDaysInMonth(2013, 12); |
getLocaleTimeFormat | ||
Description | ||
Returns time format of the location | ||
Parameters | ■location - String - possible value - 'KOR', 'USA', 'BRA', 'PANEURO', 'CHI', 'HKG', ARB', 'PANNORDIG', 'SOUTHEASTASIA', 'ASIA_ATV', 'ASIA_DTV', 'TW', 'NORTHAFRICA', 'EA_DTV', 'CIS', 'PHI', 'S_AFR_DTV'. - [default : 'USA'] | |
Return | ■String - Locale time format string | |
Emulator Support | Y | |
SDK Constraint | none | |
Example | ||
var localTimeFormat; localTimeFormat = caph.misc.Time.getLocaleTimeFormat('KOR'); |