Be concise.
Be useful.
All contributions dictatorially edited by webmasters to match personal tastes.
Please do not paste any copyright violating material.
Please try to avoid dependencies to third-party libraries and frameworks.
(def x (.format (java.text.SimpleDateFormat. "yyyy-MM-dd") d))
IDENTIFICATION DIVISION.
PROGRAM-ID. date format.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 curr-date.
03 yyyy pic 9(4).
03 mm pic 9(2).
03 dd pic 9(2).
01 d.
03 year pic 9(4).
03 FILLER pic x VALUE '-'.
03 month pic 99.
03 FILLER pic x VALUE '-'.
03 day pic 99.
PROCEDURE DIVISION.
MOVE FUNCTION CURRENT-DATE TO curr-date
MOVE yyyy to year
MOVE mm to month
MOVE dd to day
DISPLAY d
STOP RUN.
string x = d.ToString("yyyy-MM-dd");
x = Date.to_iso8601(d)
D = erlang:localtime(),
{{Year, Month, Day}, {_Hour, _Minute, _Second}} = D,
X = lists:flatten(io_lib:format("~4..0w-~2..0w-~2..0w", [Year, Month, Day])). % "2017-07-02"
program p
integer, dimension(8) :: d
character(len=10) :: x
call date_and_time (values=d)
write(x,'(i4.4,"-",i2.2,"-",i2.2)')d(1),d(2),d(3)
print *,'DATE=',x
end program p
let x = d.toISOString().slice(0, 10)
String x = String.format("%1$tY-%1$tm-%1$td", d)
x = os.date("%F",d)
// once
static NSDateFormatter *df;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
df=[[NSDateFormatter alloc] init];
df.locale=[[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"];
df.timeZone=[NSTimeZone timeZoneForSecondsFromGMT:0];
df.dateFormat=@"yyyy-MM-dd";
});
// then, wherever needed
NSString *x=[df stringFromDate:d];
$formattedVar = date("Y-m-d", strtotime($unformattedVar));
# Take the unformated Variable, let PHP do it's best to
# 'understand' it and then format the resultant into the
# desired format.
$x = date("Y-m-d", strtotime($d));
x := d yyyymmdd.
Dim x As String = d.ToString("yyyy-MM-dd")