reformatDate
session.reformatDate( String date, String dateFormatFrom, String dateFormatTo ) (professional and enterprise editions only) session.reformatDate( String date, String dateFormatTo ) (enterprise edition only) |
| Description |
| These two methods change the format of a date. The first allows you to specify the existing format of the data, where the second attempts to guess the format. |
| In the first method, the date parameter would be a scraped date as text (e.g., 01/01/2010). The dateFormatFrom and dateFormatTo parameters are special strings containing tokens that reflect the format of the dates. Internally we make use of Sun's SimpleDateFormat class to handle the formatting, and you should look at their documentation to determine how the strings should be formatted (see especially the "Examples" section). |
| In the second method, the date parameter would be a scraped date as text (e.g., 01/01/2010). The datFormatTo parameter indicates the resulting format of the date. Internally we use PHP's date method to handle the formatting. You'll want to use the tokens on the PHP documentation page to indicate the format you'd like the date to be. You can also indicate "timestamp" for the "dateFormatTo" parameter, which will return a time stamp corresponding to the original date. |
 |
| Example |
// Reformats the date shown to the format "2010-01-01". session.reformatDate( "01/01/2010", "dd/MM/yyyy", "yyyy-MM-dd" ); session.reformatDate( "01/01/2010", "Y-m-d" ); |
|
|
Recent comments
9 hours 47 min ago
9 hours 54 min ago
12 hours 1 min ago
1 day 7 hours ago
1 day 7 hours ago
1 day 8 hours ago
1 day 8 hours ago
1 day 8 hours ago
1 day 8 hours ago
3 days 5 hours ago