forked from epam/parso
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from epam/master
Feature/80 date formats (epam#84)
- Loading branch information
Showing
19 changed files
with
1,013 additions
and
252 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.epam.parso.date; | ||
|
||
/** | ||
* Option how Parso outputs dates. | ||
*/ | ||
public enum OutputDateType { | ||
/** | ||
* Outputs date as java.util.Date for date and datetime formats. | ||
* Note that time will be represented as a number. | ||
*/ | ||
JAVA_DATE_LEGACY, | ||
/** | ||
* Outputs date as LocalDate and LocalDateTime for date and datetime formats. | ||
* Note that time will be represented as a number, because of SAS time | ||
* can't be represented as a LocalTime! | ||
*/ | ||
JAVA_TEMPORAL, | ||
/** | ||
* Output date as raw SAS value. | ||
* It is number of days (for date type) or seconds(for datetime type) | ||
* since 1 January 1960 as java double. | ||
*/ | ||
SAS_VALUE, | ||
/** | ||
* Output date as number of seconds since 1 January 1970 as java double. | ||
* Note that it may contain fractional part. | ||
*/ | ||
EPOCH_SECONDS | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,245 @@ | ||
package com.epam.parso.date; | ||
|
||
/** | ||
* Collection of SAS date formats. | ||
*/ | ||
enum SasDateFormat { | ||
/** | ||
* Writes date values in the form ddmmmyy or ddmmmyyyy. | ||
* See: https://v8doc.sas.com/sashtml/lgref/z0195834.htm | ||
*/ | ||
DATE, | ||
/** | ||
* Writes date values as the day of the month. | ||
* See: https://v8doc.sas.com/sashtml/lgref/z0201472.htm | ||
*/ | ||
DAY, | ||
/** | ||
* Writes date values in the form ddmmyy or ddmmyyyy. | ||
* https://v8doc.sas.com/sashtml/lgref/z0197953.htm | ||
* See also: | ||
* https://v8doc.sas.com/sashtml/lgref/z0590669.htm | ||
*/ | ||
DDMMYY, | ||
/** | ||
* DDMMYYB with a blank separator. | ||
*/ | ||
DDMMYYB, | ||
/** | ||
* DDMMYYC with a colon separator. | ||
*/ | ||
DDMMYYC, | ||
/** | ||
* DDMMYYD with a dash separator. | ||
*/ | ||
DDMMYYD, | ||
/** | ||
* DDMMYY with N indicates no separator. | ||
* When x is N, the width range is 2-8. | ||
*/ | ||
DDMMYYN, | ||
/** | ||
* DDMMYYP with a period separator. | ||
*/ | ||
DDMMYYP, | ||
/** | ||
* DDMMYYS with a slash separator. | ||
*/ | ||
DDMMYYS, | ||
/** | ||
* Writes date values in the form mmddyy or mmddyyyy. | ||
* https://v8doc.sas.com/sashtml/lgref/z0199367.htm | ||
* See also: | ||
* https://v8doc.sas.com/sashtml/lgref/z0590662.htm | ||
*/ | ||
MMDDYY, | ||
/** | ||
* MMDDYYB with a blank separator. | ||
*/ | ||
MMDDYYB, | ||
/** | ||
* MMDDYYC with a colon separator. | ||
*/ | ||
MMDDYYC, | ||
/** | ||
* MMDDYYD with a dash separator.. | ||
*/ | ||
MMDDYYD, | ||
/** | ||
* MMDDYY with N indicates no separator. | ||
* When x is N, the width range is 2-8. | ||
*/ | ||
MMDDYYN, | ||
/** | ||
* MMDDYYP with a period separator. | ||
*/ | ||
MMDDYYP, | ||
/** | ||
* MMDDYYS with a slash separator. | ||
*/ | ||
MMDDYYS, | ||
/** | ||
* Writes date values in the form yymmdd or yyyymmdd. | ||
* https://v8doc.sas.com/sashtml/lgref/z0197961.htm | ||
* See also: | ||
* https://v8doc.sas.com/sashtml/lgref/z0589916.htm | ||
*/ | ||
YYMMDD, | ||
/** | ||
* YYMMDDB with a blank separator. | ||
*/ | ||
YYMMDDB, | ||
/** | ||
* YYMMDDC with a colon separator. | ||
*/ | ||
YYMMDDC, | ||
/** | ||
* YYMMDDD with a dash separator. | ||
*/ | ||
YYMMDDD, | ||
/** | ||
* YYMMDD with N indicates no separator. | ||
* When x is N, the width range is 2-8. | ||
*/ | ||
YYMMDDN, | ||
/** | ||
* YYMMDDP with a period separator. | ||
*/ | ||
YYMMDDP, | ||
/** | ||
* YYMMDDS with a slash separator. | ||
*/ | ||
YYMMDDS, | ||
/** | ||
* Writes date values as the month and the year and separates them with a character. | ||
* https://v8doc.sas.com/sashtml/lgref/z0199314.htm | ||
* MMYY with a M separator. | ||
*/ | ||
MMYY, | ||
/** | ||
* MMYYC with a colon separator. | ||
*/ | ||
MMYYC, | ||
/** | ||
* MMYYD with a dash separator.. | ||
*/ | ||
MMYYD, | ||
/** | ||
* MMYY with N indicates no separator. | ||
* When no separator is specified, the width range is 4-32 and the default changes to 6. | ||
*/ | ||
MMYYN, | ||
/** | ||
* MMYYP with a period separator. | ||
*/ | ||
MMYYP, | ||
/** | ||
* MMYYS with a slash separator. | ||
*/ | ||
MMYYS, | ||
/** | ||
* Writes date values as the year and month and separates them with a character. | ||
* https://v8doc.sas.com/sashtml/lgref/z0199309.htm | ||
* YYMM with a M separator. | ||
*/ | ||
YYMM, | ||
/** | ||
* YYMMC with a colon separator. | ||
*/ | ||
YYMMC, | ||
/** | ||
* YYMMD with a dash separator.. | ||
*/ | ||
YYMMD, | ||
/** | ||
* YYMM with N indicates no separator. | ||
* When no separator is specified, the width range is 4-32 and the default changes to 6. | ||
*/ | ||
YYMMN, | ||
/** | ||
* YYMMP with a period separator. | ||
*/ | ||
YYMMP, | ||
/** | ||
* YYMMS with a slash separator. | ||
*/ | ||
YYMMS, | ||
/** | ||
* Writes date values as Julian dates in the form yyddd or yyyyddd. | ||
* See: https://v8doc.sas.com/sashtml/lgref/z0197940.htm | ||
*/ | ||
JULIAN, | ||
/** | ||
* Writes date values as the Julian day of the year. | ||
* See: https://v8doc.sas.com/sashtml/lgref/z0205162.htm | ||
*/ | ||
JULDAY, | ||
/** | ||
* Writes date values as the month. | ||
* See: https://v8doc.sas.com/sashtml/lgref/z0171689.htm | ||
* Note that MONTH1. returns HEX value. | ||
*/ | ||
MONTH, | ||
/** | ||
* Writes date values as the year. | ||
* See: https://v8doc.sas.com/sashtml/lgref/z0205234.htm | ||
*/ | ||
YEAR, | ||
/** | ||
* Writes date values as the month and the year in the form mmmyy or mmmyyyy. | ||
* See: https://v8doc.sas.com/sashtml/lgref/z0197959.htm | ||
*/ | ||
MONYY, | ||
/** | ||
* Writes date values as the year and the month abbreviation. | ||
* See: https://v8doc.sas.com/sashtml/lgref/z0205240.htm | ||
*/ | ||
YYMON, | ||
/** | ||
* Writes date values by using the ISO 8601 basic notation yyyymmdd. | ||
*/ | ||
B8601DA, | ||
/** | ||
* Writes date values by using the ISO 8601 extended notation yyyy-mm-dd. | ||
*/ | ||
E8601DA, | ||
/** | ||
* Writes date values as the name of the month. | ||
* See: https://v8doc.sas.com/sashtml/lgref/z0201049.htm | ||
*/ | ||
MONNAME, | ||
/** | ||
* Writes date values as the day of the week and the date in the form day-of-week, | ||
* month-name dd, yy (or yyyy). | ||
* See: https://v8doc.sas.com/sashtml/lgref/z0201433.htm | ||
*/ | ||
WEEKDATE, | ||
/** | ||
* Writes date values as day of week and date in the form day-of-week, | ||
* dd month-name yy (or yyyy). | ||
* See: https://v8doc.sas.com/sashtml/lgref/z0201303.htm | ||
*/ | ||
WEEKDATX, | ||
/** | ||
* Writes date values as the day of the week. | ||
* See: https://v8doc.sas.com/sashtml/lgref/z0200757.htm | ||
*/ | ||
WEEKDAY, | ||
/** | ||
* Writes date values as the name of the day of the week. | ||
* See: https://v8doc.sas.com/sashtml/lgref/z0200842.htm | ||
*/ | ||
DOWNAME, | ||
/** | ||
* Writes date values as the name of the month, | ||
* the day, and the year in the form month-name dd, yyyy. | ||
* See: https://v8doc.sas.com/sashtml/lgref/z0201451.htm | ||
*/ | ||
WORDDATE, | ||
/** | ||
* Writes date values as the day, the name of the month, | ||
* and the year in the form dd month-name yyyy. | ||
* See: https://v8doc.sas.com/sashtml/lgref/z0201147.htm | ||
*/ | ||
WORDDATX | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
package com.epam.parso.date; | ||
|
||
/** | ||
* Collection of SAS datetime formats. | ||
*/ | ||
enum SasDateTimeFormat { | ||
/** | ||
* Writes datetime values in the form ddmmmyy:hh:mm:ss.ss. | ||
* See: https://v8doc.sas.com/sashtml/lgref/z0197923.htm | ||
*/ | ||
DATETIME, | ||
/** | ||
* Writes dates from datetime values by using the ISO 8601 basic notation yyyymmdd. | ||
*/ | ||
B8601DN, | ||
/** | ||
* Writes datetime values by using the ISO 8601 basic notation yyyymmddThhmmss<ffffff>. | ||
*/ | ||
B8601DT, | ||
/** | ||
* Adjusts a Coordinated Universal Time (UTC) datetime value to the user local date and time. | ||
* Then, writes the local date and time by using the ISO 8601 datetime | ||
* and time zone basic notation yyyymmddThhmmss+hhmm. | ||
*/ | ||
B8601DX, | ||
/** | ||
* Reads Coordinated Universal Time (UTC) datetime values that are specified using the | ||
* ISO 8601 datetime basic notation yyyymmddThhmmss+|–hhmm or yyyymmddThhmmss<ffffff>Z. | ||
*/ | ||
B8601DZ, | ||
/** | ||
* Writes datetime values as local time by appending a time zone offset difference between the local time and UTC, | ||
* using the ISO 8601 basic notation yyyymmddThhmmss+|–hhmm. | ||
*/ | ||
B8601LX, | ||
/** | ||
* Writes dates from SAS datetime values by using the ISO 8601 extended notation yyyy-mm-dd. | ||
*/ | ||
E8601DN, | ||
/** | ||
* Reads datetime values that are specified using the | ||
* ISO 8601 extended notation yyyy-mm-ddThh:mm:ss.<ffffff>. | ||
*/ | ||
E8601DT, | ||
/** | ||
* Adjusts a Coordinated Universal Time (UTC) datetime value to the user local date and time. | ||
* Then, writes the local date and time by using the ISO 8601 datetime | ||
* and time zone extended notation yyyy-mm-ddThh:mm:ss+hh:mm. | ||
*/ | ||
E8601DX, | ||
/** | ||
* Reads Coordinated Universal Time (UTC) datetime values that are specified using the ISO 8601 | ||
* datetime extended notation yyyy-mm-ddThh:mm:ss+|–hh:mm.<fffff> or yyyy-mm-ddThh:mm:ss.<fffff>Z. | ||
*/ | ||
E8601DZ, | ||
/** | ||
* Writes datetime values as local time by appending a time zone offset difference between the local time and UTC, | ||
* using the ISO 8601 extended notation yyyy-mm-ddThh:mm:ss+|–hh:mm. | ||
*/ | ||
E8601LX, | ||
/** | ||
* Writes datetime values in the form ddmmmyy:hh:mm:ss.ss with AM or PM. | ||
* See: https://v8doc.sas.com/sashtml/lgref/z0196050.htm | ||
*/ | ||
DATEAMPM, | ||
/** | ||
* Expects a datetime value as input and writes date values in the form ddmmmyy or ddmmmyyyy. | ||
*/ | ||
DTDATE, | ||
/** | ||
* Writes the date part of a datetime value as the month and year in the form mmmyy or mmmyyyy. | ||
*/ | ||
DTMONYY, | ||
/** | ||
* Writes the date part of a SAS datetime value as the day of the week and the date in the form | ||
* day-of-week, dd month-name yy (or yyyy). | ||
*/ | ||
DTWKDATX, | ||
/** | ||
* Writes the date part of a SAS datetime value as the year in the form yy or yyyy. | ||
*/ | ||
DTYEAR, | ||
/** | ||
* Writes datetime values in the form mm/dd/yy<yy> hh:mm AM|PM. The year can be either two or four digits. | ||
*/ | ||
MDYAMPM, | ||
/** | ||
* Writes the time portion of datetime values in the form hh:mm:ss.ss. | ||
* See: https://v8doc.sas.com/sashtml/lgref/z0201157.htm | ||
*/ | ||
TOD | ||
} |
Oops, something went wrong.