Topics
All
MacOS
(Only)
Windows
(Only)
Linux
(Only, Not)
iOS
(Only, Not)
Components
Crossplatform Mac & Win
Server
Client
Old
Deprecated
Guides
Examples
Videos
New in version:
10.1
10.2
10.3
10.4
10.5
11.0
11.1
11.2
11.3
11.4
Statistic
FMM
Blog
Parses a date.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
Time | 6.4 | ✅ Yes | ❌ No | ✅ Yes | ✅ Yes, on macOS and Linux | ✅ Yes |
Parameter | Description | Example | Flags |
---|---|---|---|
Text | The text to parse for date and/or time | "2016-11-30" | |
FormatString | The format string. | ||
Locale | The locale to use. Be aware that identifiers are not the same on Mac, Windows and Linux. |
"FR_fr" | Optional |
Returns timestamp or error.
%% | The % character. |
%a or %A | The weekday name according to the current locale, in abbreviated form or the full name. |
%b or %B or %h | The month name according to the current locale, in abbreviated form or the full name. |
%c | The date and time representation for the current locale. |
%C | The century number (0-99). |
%d or %e | The day of month (1-31). |
%D | Equivalent to %m/%d/%y. (This is the American style date, very confusing to non-Americans, especially since %d/%m/%y is widely used in Europe. The ISO 8601 standard format is %Y-%m-%d.) |
%H | The hour (0-23). |
%I | The hour on a 12-hour clock (1-12). |
%j | The day number in the year (1-366). |
%m | The month number (1-12). |
%M | The minute (0-59). |
%n | Arbitrary whitespace. |
%p | The locale's equivalent of AM or PM. (Note: there may be none.) |
%r | The 12-hour clock time (using the locale's AM or PM). In the POSIX locale equivalent to %I:%M:%S %p. If t_fmt_ampm is empty in the LC_TIME part of the current locale then the behavior is undefined. |
%R | Equivalent to %H:%M. |
%S | The second (0-60; 60 may occur for leap seconds; earlier also 61 was allowed). |
%t | Arbitrary whitespace. |
%T | Equivalent to %H:%M:%S. |
%U | The week number with Sunday the first day of the week (0-53). The first Sunday of January is the first day of week 1. |
%w | The weekday number (0-6) with Sunday = 0. |
%W | The week number with Monday the first day of the week (0-53). The first Monday of January is the first day of week 1. |
%x | The date, using the locale's date format. |
%X | The time, using the locale's time format. |
%y | The year within century (0-99). When a century is not otherwise specified, values in the range 69-99 refer to years in the twentieth century (1969-1999); values in the range 00-68 refer to years in the twenty-first century (2000-2068). |
%Y | The year, including century (for example, 1991). |
%Ec | The locale's alternative date and time representation. |
%EC | The name of the base year (period) in the locale's alternative representation. |
%Ex | The locale's alternative date representation. |
%EX | The locale's alternative time representation. |
%Ey | The offset from %EC (year only) in the locale's alternative representation. |
%EY | The full alternative year representation. The O modifier specifies that the numerical input may be in an alternative locale-dependent format: |
%Od or %Oe | The day of the month using the locale's alternative numeric symbols; leading zeros are permitted but not required. |
%OH | The hour (24-hour clock) using the locale's alternative numeric symbols. |
%OI | The hour (12-hour clock) using the locale's alternative numeric symbols. |
%Om | The month using the locale's alternative numeric symbols. |
%OM | The minutes using the locale's alternative numeric symbols. |
%OS | The seconds using the locale's alternative numeric symbols. |
%OU | The week number of the year (Sunday as the first day of the week) using the locale's alternative numeric symbols. |
%Ow | The number of the weekday (Sunday=0) using the locale's alternative numeric symbols. |
%OW | The week number of the year (Monday as the first day of the week) using the locale's alternative numeric symbols. |
%Oy | The year (offset from %C) using the locale's alternative numeric symbols. |
%F | Equivalent to %Y-%m-%d, the ISO 8601 date format. |
%g | The year corresponding to the ISO week number, but without the century (0-99). |
%G | The year corresponding to the ISO week number. (For example, 1991.) |
%u | The day of the week as a decimal number (1-7, where Monday = 1). |
%V | The ISO 8601:1988 week number as a decimal number (1-53). If the week (starting on Monday) containing 1 January has four or more days in the new year, then it is considered week 1. Otherwise, it is the last week of the previous year, and the next week is week 1. |
%z | An RFC-822/ISO 8601 standard timezone specification. |
%Z | The timezone name. |
%s | The number of seconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC). Leap seconds are not counted unless leap second support is available. |
Parse a date:
MBS( "Time.Parse"; "2016-11-30"; "%Y-%m-%d" )
Example result: 30.11.2016 00:00
Parse a timestamp:
MBS( "Time.Parse"; "2016-11-30 13:31"; "%Y-%m-%d %H:%M" )
Example result: 30.11.2016 13:31
Created 17th August 2016, last changed 17th June 2018
Feedback: Report problem or ask question.