]>
git.saurik.com Git - apple/icu.git/blob - icuSources/samples/translit/answers/main_1.cpp
1 /********************************************************************
3 * Copyright (c) 1999-2002, International Business Machines Corporation and
4 * others. All Rights Reserved.
5 ********************************************************************/
7 #include "unicode/translit.h"
8 #include "unicode/rbt.h"
9 #include "unicode/unistr.h"
10 #include "unicode/calendar.h"
11 #include "unicode/datefmt.h"
17 int main(int argc
, char **argv
) {
22 UErrorCode status
= U_ZERO_ERROR
;
23 Locale
greece("el", "GR");
24 UnicodeString str
, str2
;
26 // Create a calendar in the Greek locale
27 cal
= Calendar::createInstance(greece
, status
);
28 check(status
, "Calendar::createInstance");
31 fmt
= DateFormat::createDateInstance(DateFormat::kFull
, greece
);
32 fmt
->setCalendar(*cal
);
34 // Create a default formatter
35 defFmt
= DateFormat::createDateInstance(DateFormat::kFull
);
36 defFmt
->setCalendar(*cal
);
38 // Loop over various months
39 for (int32_t month
= Calendar::JANUARY
;
40 month
<= Calendar::DECEMBER
;
43 // Set the calendar to a date
45 cal
->set(1999, month
, 4);
47 // Format the date in default locale
49 defFmt
->format(cal
->getTime(status
), str
, status
);
50 check(status
, "DateFormat::format");
55 // Format the date for Greece
57 fmt
->format(cal
->getTime(status
), str
, status
);
58 check(status
, "DateFormat::format");
59 printf("Greek formatted date: ");
68 printf("Exiting successfully\n");