#using <System.dll> #using <System.Windows.Forms.dll> using namespace System; using namespace System::Windows::Forms;

Size: px
Start display at page:

Download "#using <System.dll> #using <System.Windows.Forms.dll> using namespace System; using namespace System::Windows::Forms;"

Transcription

1 Lecture #12 Handling date and time values Handling Date and Time Values In the.net Framework environment, the DateTime value type represents dates and times with values ranging from 12:00:00 midnight, January 1, 0001 Anno Domini (Common Era) through 11:59:59 P.M., December 31, 9999 A.D.. A DateTime value is always expressed in the context of an explicit or default calendar. Time values are measured in 100-nanosecond units called ticks, and a particular date is the number of ticks since 12:00 midnight, January 1, 0001 A.D. (C.E.) in the GregorianCalendar calendar. For example, a tick value of L represents the date, Friday, January 01, :00:00 midnight. Since the DateTime is a non-static member of the System class, it needs a value as reference to retrieve values. There are three reference value you can use: Now: Gets a DateTime object that is set to the current date and time on this computer, expressed as the local time. Today: Gets the current date. UtcNow: tells the date and time as it would be in Coordinated Universal Time, which is also called the Greenwich Mean Time time zone. To use them, you declare a variable as DateTime type, and reference the variable to either Now or Today. For example, DateTime dt = DateTime::Now; MessageBox::Show(Convert::ToString(dt)); A short-hand way is: DateTime dt = DateTime::Now; MessageBox::Show(dt+""); Alternatively, you can simply convert the referenced Now or Today value to a string. For example, Visual C++ Programming Penn Wu, PhD 321

2 MessageBox::Show(Convert::ToString(DateTime::Today)); Without using the Convert::ToString() method, you can simply concatenate the DateTime value with a NULL string. For example, MessageBox::Show(DateTime::Today + ""); By calling any of the overloads of the DateTime constructor that allow you to specify specific elements of the date and time value (such as the year, month, and day, or the number of ticks). The DateTime constructor can initialize a new instance of the DateTime structure based on a list of available forms. One form of the DateTime constructor support the following syntax to initialize a new instance of the DateTime structure to the specified year, month, and day. DateTime(year, month, day) For example, the following sets the date to May 1, DateTime dt = DateTime(2018, 5, 1); MessageBox::Show(dt + ""); The output looks: Another form is: DateTime(year, month, day, hour, minute, second) The following statement illustrates a call to one of the DateTime constructors to create a date with a specific year, month, day, hour, minute, and second. It sets the date and time to May 1, 2018, 8:30:52. Visual C++ Programming Penn Wu, PhD 322

3 DateTime dt = DateTime(2018, 5, 1, 8, 30, 52); MessageBox::Show(dt + ""); The output looks: By assigning the DateTime object a date and time value returned by a property or method. The following example assigns the current date and time, the current Coordinated Universal Time (UTC) date and time, and the current date to three new DateTime variables. DateTime dt1 = DateTime.Now; DateTime dt2 = DateTime.Today; DateTime dt3 = DateTime.UtcNow; Once the DateTime object (variable) has a reference valve, you can use the following commonly used properties to retrieve specific data: Date: Gets the date related values express as a string. DayOfWeek: Gets the day of the week expressed as a string value such as Sunday. Day: Gets the day of the month expressed as an integral value between 1 and 31. DayOfYear: Gets the day of the year expressed as an integral value between 1 and 366. Hour: Gets the hour value of the date expressed as an integral value between 0 and 23. Minute: Gets the minute value of the date expressed as an integral value between 0 and 59. Month: Gets the month value of the date expressed as an integral value between 1 and 12. Second: Gets the seconds value of the date expressed as an integral value between 0 and 59. Year: Gets the year value of the date expressed as an integral value between 1 and For example, String^ str; DateTime dt = DateTime::Today; str = Convert::ToString(dt.Date) + "\n" + Convert::ToString(dt.DayOfWeek) + "\n" + Convert::ToString(dt.Day) + "\n" + Convert::ToString(dt.DayOfYear) + "\n" + Convert::ToString(dt.Month) + "\n" + Convert::ToString(dt.Year) + "\n"; Visual C++ Programming Penn Wu, PhD 323

4 MessageBox::Show(str); You can take advantages of these properties by using them to create programs like Christmas countdown. For example, DateTime dt = DateTime::Now; DateTime xmas = DateTime(DateTime::Now.Year, 12, 25); if ((xmas.dayofyear - dt.dayofyear) < 0) MessageBox::Show("You missed the " + DateTime::Now.Year + " Christmas!"); else MessageBox::Show("Just " + (xmas.dayofyear - dt.dayofyear) + " day(s) to " + DateTime::Now.Year + " Christmas!"); A sample output looks: Commonly used methods are: ToLocalTime(): Converts the value of the current DateTime object to local time. ToLongDateString(): Converts the value of the current DateTime object to its equivalent long date string representation. ToLongTimeString(): Converts the value of the current DateTime object to its equivalent long time string representation. ToShortDateString(): Converts the value of the current DateTime object to its equivalent short date string representation. ToShortTimeString(): Converts the value of the current DateTime object to its equivalent short time string representation. ToUniversalTime(): Converts the value of the current DateTime object to Coordinated Universal Time (UTC). Notice that all these methods are meant to convert a given date/time value to different format, namely they must be given a value. In the following example, the dt variable (object) get the date/time value from the computer. Visual C++ Programming Penn Wu, PhD 324

5 String^ str = "Output formats:\n"; DateTime dt = DateTime::Now; str += "ToLocalTime: " + dt.tolocaltime() + "\n" + "ToLongDateString: " + dt.tolongdatestring() + "\n" + "ToLongTimeString: " + dt.tolongtimestring() + "\n" + "ToShortDateString: " + dt.toshortdatestring() + "\n" + "ToShortTimeString: " + dt.toshorttimestring() + "\n" + "ToUniversalTime: " + dt.touniversaltime() + "\n"; MessageBox::Show(str); A sample output looks: Another example, String^ str = Convert::ToString(DateTime::Now.ToLocalTime()); MessageBox::Show(str); The DataTime class can be used as a method that specifies a new DateTime value. The syntax is: DateTime(year,month,day,hour,minute,second,millisecond,Calendar ) where year, month, day, hour, minute, second, and millisecond are Int32 integers. Calendar is used for specifying calendar type. For example, to specify the DateTime value of the Christmas of the current year (given by DataTime::Now.Year), use: Visual C++ Programming Penn Wu, PhD 325

6 DateTime xmas = DateTime(Convert::ToInt32(DateTime::Now.Year),12,25,0,0,0); MessageBox::Show(xmas + ""); If you add the following to the namespace section, you can then use display the Christmas date in Chinese Calendar. DateTime cxmas = DateTime(Convert::ToInt32(DateTime::Now.Year),12,25); ChineseLunisolarCalendar^ ch = gcnew ChineseLunisolarCalendar; int d = ch->getdayofmonth(cxmas); // convert to Chinese value int m = ch->getmonth(cxmas); // convert to Chinese month int y = ch->getyear(cxmas); // convert to Chinese year cxmas = DateTime(y, m, d); MessageBox::Show(Convert::ToString(DateTime::Now.Year) + " Christmas is " + cxmas + " in Chinese calendar!"); A sample output looks: In one of the previous lecture, you had learned to write the code to return the Chinese Zodiac. The following is a much precise version. #include "InputBox.cpp" String^ str = InputBox::Show("Enter your birthdate [yyyy, mm, dd]: "); DateTime bd = DateTime(Convert::ToDateTime(str)); Visual C++ Programming Penn Wu, PhD 326

7 ChineseLunisolarCalendar^ ch = gcnew ChineseLunisolarCalendar; int d = ch->getdayofmonth(bd); // convert to Chinese value int m = ch->getmonth(bd); // convert to Chinese month int y = ch->getyear(bd); // convert to Chinese year bd = DateTime(y, m, d); String^ zd =""; switch (y%12) case 0: zd = "Monkey"; break; case 1: zd = "Rooster"; break; case 2: zd = "Dog"; break; case 3: zd = "Pig"; break; case 4: zd = "Rat"; break; case 5: zd = "Ox"; break; case 6: zd = "Tiger"; break; case 7: zd = "Rabbit"; break; case 8: zd = "Dragon"; break; case 9: zd = "Snake"; break; case 10: zd = "Horse"; break; case 11: zd = "Goat"; break; MessageBox::Show(bd + "\nyour were born in " + zd + " year in Chinese calendar!"); The other calendar types are: ChineseLunisolarCalendar EastAsianLunisolarCalendar GregorianCalendar HebrewCalendar HijriCalendar JulianCalendar PersianCalendar ThaiBuddhistCalendar UmAlQuraCalendar For example, DateTime cxmas = DateTime(Convert::ToInt32(DateTime::Now.Year),12,25); PersianCalendar^ ps = gcnew PersianCalendar; int d = ps->getdayofmonth(cxmas); // convert to Persian value int m = ps->getmonth(cxmas); // convert to Persian month int y = ps->getyear(cxmas); // convert to Persian year Visual C++ Programming Penn Wu, PhD 327

8 cxmas = DateTime(y, m, d); MessageBox::Show(Convert::ToString(DateTime::Now.Year) + " Christmas is " + cxmas + " in Persian calendar!"); A sample output looks: The DateTimePicke r class The.NET Framework provides a DateTimePicker class which provides a set of tools that allow the user to select a date and a time and to display the date and time with a specified format. The following creates a new DateTimePicker control and initialize it. DateTimePicker^ datetimepicker1 = gcnew DateTimePicker; The following is a simple code that creates a DateTimePicker object. #using <System.Drawing.dll> using namespace System::Drawing; public ref class Form1: public Form DateTimePicker^ datetimepicker1; //global public: Form1() datetimepicker1 = gcnew DateTimePicker; datetimepicker1->location = Point(10, 10); datetimepicker1->valuechanged += gcnew EventHandler(this, &Form1::dateTimePicker1_ValueChanged); Controls->Add(dateTimePicker1); private: Void datetimepicker1_valuechanged(object^ sender, EventArgs^ e) int d = Convert::ToInt16(dateTimePicker1->Value.Day); int m = Convert::ToInt16(dateTimePicker1->Value.Month); int y = Convert::ToInt16(dateTimePicker1->Value.Year); DateTime dt = DateTime(y, m, d); MessageBox::Show("The date you picked is " + dt); ; [STAThread] Visual C++ Programming Penn Wu, PhD 328

9 int main() Application::Run(gcnew Form1); A sample output looks: The ValueChanged event raises when the Value property changes. User input is validated before this event is raised; therefore, you can use this event to handle data and time value settings. The DateTimePicker class supports the Value property to set the date/time value based on the DateTime structure; therefore, you can use the following format to assign special DateTime values. and datetimepicker1->value.propertyname For example, Value.Day gets the day of the month represented by this instance. Value.Month gets the month component of the date represented by this instance. Value.Year gets the year component of the date represented by this instance. Value.Now gets a DateTime object that is set to the current date and time on this computer, expressed as the local time. The MaxDate property sets the maximum date and time that can be selected in the control. The MinDate property sets the minimum date and time that can be selected in the control. The following sets the MinDate and MaxDate. datetimepicker1->mindate = DateTime(2005, 12, 31); datetimepicker1->maxdate = DateTime::Today; The ShowCheckBox property is a Boolean property that sets whether a check box is displayed to the left of the selected date. The ShowUpDown sets whether a spin button control (also known as an up-down control) is used to adjust the date/time value. The following code can show the CheckBox and display the control as an up-down control. datetimepicker1->showcheckbox = true; datetimepicker1->showupdown = true; If you rather use a customized date format, you need to set the CustomFormat string. Visit for a list of directives that may be used to defined the date and time format. To display string literals that contain date and time separators or to format strings, you must use escape characters in the substring. For example, to display the date as June 15 at 12:00 PM, set the CustomFormat property to "MMMM dd 'at' t:mm tt". If the at substring is not enclosed by escape characters, the result is June 15 ap 12:00PM because the t character is read as the one-letter A.M./P.M. format string. The format strings can be combined to format the date and time. For example, to display the date and time as 06/15/ :00 PM, this property should be set to "MM'/'dd'/'yyyy hh':'mm tt". Visual C++ Programming Penn Wu, PhD 329

10 The Format property actually sets the format of the date and time displayed in the control. The Format property must be set to DateTimePickerFormat::Custom for the CustomFormat property to affect the formatting of the displayed date and time. The following statements set the CustomFormat string. datetimepicker1->customformat = "MMMM dd, yyyy - dddd"; datetimepicker1->format = DateTimePickerFormat::Custom; Handling time zone You can use the TimeZone class to retrieve information about the current time zone, and to convert times from local time to any time zone. The TimeZOne class is usually used as a Data type, with which you can define a variable (object) and use it to work with the methods and properties of the TimeZone class. Three properties are: CurrentTimeZone: Gets the time zone of the current computer. DaylightName: Gets the daylight saving time zone name. StandardName: Gets the standard time zone name. The following example retrieve your current time zone and the daylight saving time zone name TimeZone^ tz = TimeZone::CurrentTimeZone; MessageBox::Show("Your time zone: " + tz->standardname + "\n" + "Your daylight time zone: " + tz->daylightname); The output looks: Interestingly, Microsoft recommends the programmers to use the TimeZoneInfo class instead of the TimeZone class whenever possible. The TimeZoneInfo class represents any time zone in the world. It supports the following properties: BaseUtcOffset: Gets the time difference between the current time zone s standard time and Coordinated Universal Time (UTC). DaylightName: Gets the display name for the current time zone's daylight saving time. DisplayName: Gets the general display name that represents the time zone. Id: Gets the time zone identifier. Local: Gets a TimeZoneInfo object that represents the local time zone. StandardName: Gets the display name for the time zone's standard time. Visual C++ Programming Penn Wu, PhD 330

11 SupportsDaylightSavingTime: Gets a value indicating whether the time zone has any daylight saving time rules. Utc: Gets a TimeZoneInfo object that represents the Coordinated Universal Time (UTC) zone. The following illustrates how to use this class. TimeZoneInfo^ tz = TimeZoneInfo::Local; MessageBox::Show("Your time zone: " + tz->standardname + "\n" + "Your daylight time zone: " + tz->daylightname + "\n" + "General name: " + tz->displayname + "\n" + "Time zone ID: " + tz->id + "\n" + ); The output looks: Formatting date and time values The DateTimeFormatInfo class of the System.Globalization namespace defines how DateTime values are formatted and displayed, depending on the culture. This class contains information, such as date patterns, time patterns, and AM/PM designators. In practice, you need to add the following to the namespace section in order to use the designators, which are parameters representing pre-defined formats. Using namespace System::Globalization; Simply declare a variable (object) which represents a DateTime value, and then use the ToString() method with designator in it to specify the format. For example, to use the F designator: Visual C++ Programming Penn Wu, PhD 331

12 The output is: String^ str = "Date time formats:\n\n"; DateTime bt = DateTime(2025,11,30, 12,29,37); str += bt.tostring("d") + "\n" + bt.tostring("d") + "\n" + bt.tostring("f") + "\n" + bt.tostring("f") + "\n" + bt.tostring("g") + "\n" + bt.tostring("g") + "\n" + bt.tostring("t") + "\n" + bt.tostring("t") + "\n" + bt.tostring("u") + "\n" + bt.tostring("u") + "\n"; MessageBox::Show(str); Commonly used designators are: designator Description d ShortDatePattern D LongDatePattern f Full date and time (long date and short time) F FullDateTimePattern (long date and long time) g General (short date and short time) G General (short date and long time) m or M MonthDayPattern t ShortTimePattern T LongTimePattern u Universal Sortable DateTime Pattern. Using the format for universal time display; with this format pattern, the formatting or parsing operation always uses the invariant culture U Full date and time (long date and long time) using universal time y or Y YearMonthPattern All the above designators represent pre-defined format, and you cannot customize the formats. If there is a need to customize the format, you will need to refer to the table in which lists the custom DateTime format patterns and their behavior. For example, given a customized date and time format, Visual C++ Programming Penn Wu, PhD 332

13 String^ str = DateTime::Now.ToString("dd MMM, yyyy... HH-mm-ss tt"); MessageBox::Show(str); A sample output looks: Handling Daylight saving time Daylight saving time is a period during the year when the time is advanced, usually by an hour, to take advantage of the extended daylight hours. There is a DaylightTime class of the System::Globalization class. You can use it to define the period of daylight saving time. At the end of the period, the time is set back to the standard time. Be sure to add the following line to the namespace section in order to use this class. Using namespace System::Globalization; Usually DaylightTime is used as a method. The syntax is: DaylightTime(Start, End, Delta) Parameters are: Start: The DateTime that represents the date and time when the daylight saving period begins. The value must be in local time. End: The DateTime that represents the date and time when the daylight saving period ends. The value must be in local time. Delta: The TimeSpan that represents the difference between the standard time and the daylight saving time in ticks. For example, assuming President Robots in 2050 announced that the starting and ending dates of daylight saving time for 2051 is Feb 12 and Dec 10, You can use the following code to redefine the daylight saving time period for the year (Note: It is supposed be between Mar 12 ~ Nov 5, 2051) DaylightTime^ dt = gcnew DaylightTime(DateTime(2051,2,11), DateTime(2051,12,10), TimeSpan(2,0,0)); Visual C++ Programming Penn Wu, PhD 333

14 The above code uses the TimeSpan structure with the following syntax to initialize a new instance of the TimeSpan structure to a specified number of hours, minutes, and seconds. TimeSpan(hours, minutes, seconds) A TimeSpan object represents a time interval (duration of time or elapsed time) that is measured as a positive or negative number of days, hours, minutes, seconds, and fractions of a second. The TimeSpan structure can also be used to represent the time of day, but only if the time is unrelated to a particular date. These three parameters, Start, End, and Delta, of the DaylightTime object are also used as properties. For example, TimeZone^ tz = TimeZone::CurrentTimeZone; DaylightTime^ dt = tz- >GetDaylightChanges( DateTime::Now.Year ); String^ str = "In " + DateTime::Now.Year + ", the dayling saving time\n" + "\tstarts on : " + dt->start + "\n" + "\tends on : " + dt->end +"\n" + "\tdifference : " + dt->delta ; MessageBox::Show(str); The GetDaylightChanges() method returns the daylight saving time period for a particular year. A sample output looks: The IsDaylightSavingTime() method returns a value indicating whether the specified date and time is within a daylight saving time period. For example, the following returns a Boolean value (either True or False). Visual C++ Programming Penn Wu, PhD 334

15 int main() TimeZone^ tz = TimeZone::CurrentTimeZone; MessageBox::Show(tz->IsDaylightSavingTime(DateTime::Now)+""); Designing a simple world clock Many of the tools introduced in this lecture are useful in handling date and time. One example is to create a simple world clock with calendar. The DateTime structure helps to retrieve the current local date and time values as well as those of UTC. The following creates two DateTime objects, dt and ut, for holding the current date and time values of local and UTC time zone. DateTime dt = DateTime::Now; // current local time DateTime ut = DateTime::UtcNow; // current UTC date time The instructor chooses the G directive to display the date and time values in the format of short date and long time (e.g. 9/14/2019 5:27:56 PM). MessageBox::Show(dt.ToString("G") + ""); The TimeZoneInfo structure helps to retrieve information of the local time zone. The DisplayName property returns the name of the local time zone. TimeZoneInfo^ tz = TimeZoneInfo::Local; MessageBox::Show(tz->DisplayName + ""); The TimeSpan structure can contribute to the calculation of time difference across time zones. It is necessary to know that London, UK is in a time zone that has a +1 hour offset against the UTC time zone. ut = DateTime::UtcNow; // current UTC date time DateTime ld = ut + TimeSpan(1, 0, 0); // offset: +1 hour The following is a sample code that displays local (wherever the user is), UTC, and London date and time values in a Windows Form application. By the way, the instructor chooses to display these values by Label controls. #using <System.Drawing.dll> using namespace System::Drawing; public ref class Form1: public Form Label^ local; Label^ utc; Label^ London; DateTime dt; DateTime ut; //UTC date time DateTime ld; //London date time Visual C++ Programming Penn Wu, PhD 335

16 public: Form1() this->size = Drawing::Size(300, 400); TimeZoneInfo^ tz = TimeZoneInfo::Local; dt = DateTime::Now; // current local time local = gcnew Label; local->text = "Local: " + dt.tostring("g") + "\n" + tz- >DisplayName; local->autosize = true; local->location = Point(10, 10); Controls->Add(local); ut = DateTime::UtcNow; // current UTC date time utc = gcnew Label; utc->text = "UTC: " + ut.tostring("g"); utc->autosize = true; utc->location = Point(10, 110); Controls->Add(utc); ld = ut + TimeSpan(1, 0, 0); // London and UTC time zone offset: +1 hour ; London = gcnew Label; London->Text = "London: " + ld.tostring("g"); London->AutoSize = true; London->Location = Point(10, 210); Controls->Add(London); [STAThread] int main() Application::Run(gcnew Form1); The above code only displays the date and time values once. It cannot update the contents. To turn it into a clock, there is a need to add a Timer component with a Tick event to update the date and time value every second. The following creates a Timer component named timer1, sets its Interval to 1000 milliseconds (which equals to 1 second), ties timer1 with a Tick event, associates the Tick event with an event handler named timer1_tick, and starts the timer. Timer^ timer1 = gcnew Timer; timer1->tick += gcnew EventHandler(this, &Form1::timer1_Tick); timer1->interval = 1000; timer1->start(); The event handler is responsible for updating the date and time values of every time zones. The following is the sample code. private: System::Void timer1_tick(object^ sender, EventArgs^ e) tz = TimeZoneInfo::Local; dt = DateTime::Now; // current local time local->text = "Local: " + dt.tostring("g") + "\n" + tz- >DisplayName; Visual C++ Programming Penn Wu, PhD 336

17 ut = DateTime::UtcNow; // current UTC date time utc->text = "UTC: " + ut.tostring("g"); ld = ut + TimeSpan(1, 0, 0); // London-UTC time zone offset: +1 hour London->Text = "London: " + ld.tostring("g"); Review Questions 1. In Visual Studio, the Time values are measured in. A. 10-milliseconds B. 100-milliseconds C. 10-nanoseconds D. 100-nanoseconds 2. Given the following code, which statement is correct? DateTime dt = DateTime(6, 5, 7, 8, 9, 10); A. The year value is B. The month value is 7. C. The minute value is 9. D. The minute value is Which statement can specify the DateTime value of the Christmas of the current year? A. DateTime xmas = DateTime(Now.Year,12,25,0,0,0); B. DateTime xmas = DateTime(DateTime::Now.Year,12,25,0,0,0); C. DateTime xmas = DateTime(Convert::ToInt32(Now.Year),12,25,0,0,0); D. DateTime xmas = DateTime(Convert::ToInt32(DateTime::Now.Year),12,25,0,0,0); 4. Which assigns the current Coordinated Universal Time (UTC) date and time? A. DateTime dt1 = DateTime.Now; B. DateTime dt2 = DateTime.Today; C. DateTime dt3 = DateTime.UtcNow; D. DateTime dt4 = DateTime.UtcToday; 5. Given the following code, which can display the day of the month expressed as an integral value between 1 and 31, as caption of label2? DateTime dt = DateTime::Today; A. label2->text = Convert::ToString(dt.Date); B. label2->text = Convert::ToString(dt.DayOfWeek); C. label2->text = Convert::ToString(dt.Day); D. label2->text = Convert::ToString(dt.DayOfYear); 6. Given the following code, which can convert the current time to a format of "10:46:06 PM"? DateTime dt = DateTime::Now; A. dt.tolocaltime() B. dt.tolongdatestring() C. dt.tolongtimestring() D. dt.toshortdatestring() 7. Which can get the current year value? A. DateTime::Now.Year B. DateTime::Year Visual C++ Programming Penn Wu, PhD 337

18 C. DateTime::CurrentYear D. DateTime::Year.Now 8. Which property of the TimeZone class gets the daylight saving time zone name? A. DaylightName B. DaylightValue C. CurrentDaylightName D. Daylight 9. Which can set the output of current date and time values to a format of "12 Aug, "? A. DateTime::Now.ToString("dd mmm, yyyy HH-mm-ss tt"); B. DateTime::Now.ToString("dd MMM, yyyy HH-mm-ss tt"); C. DateTime::Now.ToString("dd MMM, YYYY HH-mm-ss TT"); D. DateTime::Now.ToString("DD mmm, yyyy HH-MM-ss tt"); 10. Given the following code segment, which statement is correct? DaylightTime^ dt = gcnew DaylightTime(DateTime(2051,2,11), DateTime(2051,12,10), TimeSpan(2,0,0)); A. 2051,12,10 is the date and time when the daylight saving period begins. B. 2051,2,11 is the date and time when the daylight saving period ends. C. 2,0,0 is the difference between the standard time and the daylight saving time in ticks. D. 2,0,0 is the indicator of time zone in which the dayling saving time is going on. Visual C++ Programming Penn Wu, PhD 338

19 Lab #12 Handling Date and Time Values Learning Activity #1: Christmas Countdown 1. Launch the Developer Command Prompt (not the regular Command Prompt) and change to the C:\cis223 directory. 2. Use Notepad to create a new text file C:\cis223\lab12_1.cpp with the following contents: #using <System.Drawing.dll> using namespace System::Drawing; public ref class Form1: public Form Label^ label1; public: Form1() label1 = gcnew Label; label1->location = Point(10, 10); label1->size = Drawing::Size(300, 25); this->controls->add(label1); this->size = Drawing::Size(300,100); this->load += gcnew EventHandler(this, &Form1::Form1_Load); private: Void Form1_Load(Object^ sender, EventArgs^ e) DateTime dt = DateTime::Now; DateTime xmas = DateTime(DateTime::Now.Year, 12, 25); if ((xmas.dayofyear - dt.dayofyear) < 0) label1->text = "The " + DateTime::Now.Year + " Christmas has just passed!"; else label1->text = "Just " + (xmas.dayofyear - dt.dayofyear) + " day(s) to " + DateTime::Now.Year + " Christmas!"; ; [STAThread] int main() Application::Run(gcnew Form1); 3. Type cl /clr lab12_1.cpp /link /subsystem:windows /ENTRY:main and press [Enter] to compile. Test the program. A sample output looks: Visual C++ Programming Penn Wu, PhD 339

20 or 4. Download the assignment template, and rename it to lab12.doc if necessary. Capture a screen shot similar to the above figure and paste it to the Word document named lab12.doc (or.docx). Learning Activity #2: 1. In the C:\cis223 directory, use Notepad to create a new file named lab12_2.cpp with the following contents: #using <System.Drawing.dll> using namespace System::Drawing; public ref class Form1: public Form Label^ label1; Label^ label2; ListBox^ listbox1; public: Form1() label1 = gcnew Label; label1->location = Point(10, 10); label1->size = Drawing::Size(300, 25); this->controls->add(label1); label2 = gcnew Label; label2->location = Point(10, 50); label2->size = Drawing::Size(300, 25); this->controls->add(label2); listbox1 = gcnew ListBox; listbox1->location = Point(10, 60); listbox1->height = 150; listbox1->width = 250; listbox1->items->clear(); listbox1->items->add(""); listbox1->items->add("01. Hawaii"); listbox1->items->add("02. Alaska"); listbox1->items->add("03. Pacific Standard Time"); listbox1->items->add("04. Mountain Standard Time"); listbox1->items->add("05. Central Standard Time"); listbox1->items->add("06. Eastern Standard Time"); listbox1->items->add("07. Atlantic Standard Time"); this->controls->add(listbox1); Button^ button1 = gcnew Button; button1->text = "Convert"; button1->location = Point(10, 210); button1->size = Drawing::Size(80, 25); button1->click += gcnew EventHandler(this, &Form1::button1_Click); this->controls->add(button1); TimeZone^ tz = TimeZone::CurrentTimeZone; label1->text = "You are currently in the " + tz->standardname + ".\n" + Visual C++ Programming Penn Wu, PhD 340

21 "The time is " + DateTime::Now.ToString("t"); label2->text = "Select a different time zone"; private: Void button1_click(object^ sender, EventArgs^ e) if (listbox1->text!= "") // get the first two letters of selected item String^ str = Convert::ToString(listBox1->Text->Remove(2)); // change the hourly value to UTC time zone int utc_h = DateTime::Now.ToUniversalTime().Hour; int h; // variable represent destination hour //adjust time due to time zone offset based on UTC if (str == "01") h = utc_h - 10; else if (str == "02") h = utc_h - 8; else if (str == "03") h = utc_h - 7; else if (str == "04") h = utc_h - 6; else if (str == "05") h = utc_h - 5; else if (str == "06") h = utc_h - 4; else if (str == "07") h = utc_h - 3; //make sure hour value is between 0 and 23 if (h>=24) h=h-24; else if (h<0) h=h+24; //destination's AM-PM String^ ap; if (h>12) ap="pm"; else ap ="AM"; label2->text = "The destination time is " + h + ":" + Convert::ToString(DateTime::Now.Minute) + " " + ap; else MessageBox::Show("You must select an item."); ; [STAThread] int main() Application::Run(gcnew Form1); 2. Test the program. Visual C++ Programming Penn Wu, PhD 341

22 3. Capture a screen shot similar to the above figure and paste it to the Word document named lab12.doc (or.docx). Learning Activity #3: A Simple World Clock 1. In the C:\cis223 directory, use Notepad to create a new file named lab12_3.cpp with the following contents: #using <System.Drawing.dll> using namespace System::Drawing; public ref class Form1: public Form Label^ local; Label^ utc; Label^ London; Label^ Tokyo; DateTime dt; DateTime ut; //UTC date time DateTime ld; //London date time DateTime ty; //Tokyo date time TimeZoneInfo^ tz; public: Form1() this->size = Drawing::Size(300, 400); this->text = "Simple Word Clock"; tz = TimeZoneInfo::Local; dt = DateTime::Now; // current local time local = gcnew Label; local->text = "Local: " + dt.tostring("g") + "\n" + tz->displayname; local->autosize = true; local->location = Point(10, 10); Controls->Add(local); ut = DateTime::UtcNow; // current UTC date time utc = gcnew Label; utc->text = "UTC: " + ut.tostring("g"); utc->autosize = true; utc->location = Point(10, 110); Controls->Add(utc); ld = ut + TimeSpan(1, 0, 0); // London and UTC time zone offset: +1 hour London = gcnew Label; London->Text = "London: " + ld.tostring("g"); London->AutoSize = true; London->Location = Point(10, 210); Controls->Add(London); ty = ut + TimeSpan(9, 0, 0); // Tokyo and UTC time zone offset: +9 hour Visual C++ Programming Penn Wu, PhD 342

23 Tokyo = gcnew Label; Tokyo->Text = "Tokyo: " + ty.tostring("g"); Tokyo->AutoSize = true; Tokyo->Location = Point(10, 310); Controls->Add(Tokyo); Timer^ timer1 = gcnew Timer; timer1->tick += gcnew EventHandler(this, &Form1::timer1_Tick); timer1->interval = 1000; timer1->start(); private: System::Void timer1_tick(object^ sender, EventArgs^ e) tz = TimeZoneInfo::Local; dt = DateTime::Now; // current local time local->text = "Local: " + dt.tostring("g") + "\n" + tz->displayname; ut = DateTime::UtcNow; // current UTC date time utc->text = "UTC: " + ut.tostring("g"); ld = ut + TimeSpan(1, 0, 0); // London and UTC time zone offset: +1 hour London->Text = "London: " + ld.tostring("g"); ty = ut + TimeSpan(9, 0, 0); // Tokyo and UTC time zone offset: +9 hour Tokyo->Text = "Tokyo: " + ty.tostring("g"); ; [STAThread] int main() Application::Run(gcnew Form1); 2. Test the program. A sample output looks: 3. Capture a screen shot similar to the above figure and paste it to the Word document named lab12.doc (or.docx). Learning Activity #4: 1. In the C:\cis223 directory, use Notepad to create a new file named lab12_4.cpp with the following contents: Visual C++ Programming Penn Wu, PhD 343

24 #using <System.Drawing.dll> using namespace System::Drawing; public ref class Form1: public Form DateTimePicker^ datetimepicker1; Label^ label1; public: Form1() label1 = gcnew Label; label1->location = Point(10, 70); label1->size = Drawing::Size(300, 100); label1->text = "In Western calendar"; datetimepicker1 = gcnew DateTimePicker; datetimepicker1->location = Point(10, 10); Button^ button1 = gcnew Button; button1->text = "Go"; button1->location = Point(230, 10); button1->size = Drawing::Size(30, 25); button1->click += gcnew EventHandler(this, &Form1::button1_Click); Controls->Add(dateTimePicker1); Controls->Add(label1); Controls->Add(button1); this->size = Drawing::Size(300,300); private: Void button1_click(object^ sender, EventArgs^ e) int d = Convert::ToInt16(dateTimePicker1->Value.Day); int m = Convert::ToInt16(dateTimePicker1->Value.Month); int y = Convert::ToInt16(dateTimePicker1->Value.Year); ChineseLunisolarCalendar^ ch = gcnew ChineseLunisolarCalendar; DateTime dt = DateTime(y, m, d); // convert the picked date to DateTime format d = ch->getdayofmonth(dt); // convert to Chinese dayofmonth m = ch->getmonth(dt); // convert to Chinese month y = ch->getyear(dt); // convert to Chinese year DateTime ch1 = DateTime(y, m, d); // covert Chinese values to DateTime label1->text = "In Chinese Calendar:\n" + ch1.tolongdatestring(); ; [STAThread] int main() Application::Run(gcnew Form1); 2. Compile and test the program. Pick any date (any year), and click the Go button. A sample output looks: Visual C++ Programming Penn Wu, PhD 344

25 3. Capture a screen shot similar to the above figure and paste it to the Word document named lab12.doc (or.docx). Learning Activity #5: 1. In the C:\cis223 directory, use Notepad to create a new file named lab12_5.cpp with the following contents: int main() TimeZone^ tz = TimeZone::CurrentTimeZone; DaylightTime^ dt = tz->getdaylightchanges( DateTime::Now.Year ); String^ str = "In " + DateTime::Now.Year + ", the dayling saving time\n" + "\tstarts on : " + dt->start + "\n" + "\tends on : " + dt->end +"\n" + "\tdifference : " + dt->delta ; str += "\n\n"; DaylightTime^ dt2 = gcnew DaylightTime(DateTime(2051,2,11), DateTime(2051,12,10), TimeSpan(2,0,0)); str += "In 2051, the dayling saving time has been reset to\n" + "\tstarts on : " + dt2->start + "\n" + "\tends on : " + dt2->end +"\n" + "\tdifference : " + dt2->delta ; MessageBox::Show(str); 2. Test the program. 3. Capture a screen shot similar to the above figure and paste it to the Word document named lab12.doc (or.docx). Visual C++ Programming Penn Wu, PhD 345

26 Submittal 1. Complete all the 5 learning activities and the programming exercise in this lab. 2. Create a.zip file named lab12.zip containing ONLY the following self-executable files. lab12_1.exe lab12_2.exe lab12_3.exe lab12_4.exe lab12_5.exe lab12.doc (or lab12.docx or.pdf) [You may be given zero point if this Word document is missing] 3. Log in to Blackboard, and enter the course site. 4. Upload the zipped file to Question 11 of Assignment 12 as response. 5. Upload ex12.zip file to Question 12 as response. Note: You will not receive any credit if you submit file(s) to the wrong question. Programming Exercise 12: 1. Launch the Developer Command Prompt. 2. Use Notepad to create a new text file named ex12.cpp. 3. Add the following heading lines (Be sure to use replace [YourFullNameHere] with the correct one). //File Name: ex12.cpp //Programmer: [YourFullNameHere] 4. Write codes that will allow users to use a DateTimePicker control to pick any future date, countdown the days to that particular date, display the numbers of days to that date in a Label control. If the user picks a date in the past be sure to display Please pick a future date. On the Label control. 5. Compile the source code to produce executable code. and 6. Download the programming exercise template, and rename it to ex12.doc if necessary. Capture Capture a screen similar to the above figures and paste it to the Word document named ex12.doc (or.docx). 7. Compress the source file (ex12.cpp), executable code (ex12.exe), and Word document (ex12.doc) to a.zip file named ex12.zip. Grading criteria: You will earn credit only when the following requirements are fulfilled. No partial credit is given. You successfully submit both source file and executable file. Your source code must be fully functional and may not contain syntax errors in order to earn credit. Your executable file (program) must be executable to earn credit. Threaded Discussion Note: Students are required to participate in the thread discussion on a weekly basis. Student must post at least two messages as responses to the question every week. Each message must be posted on a different date. Grading is based on quality of the message. Question: Class, Visual C++ provides many classes with methods to handle data and time values. If you have to write an application for an travel agency which requires your application to be able to verify the "return date" given by a user is later than the "departure date". How would you solve this coding problem? If you can, provide an example to support your perspective. [There is never a right-orwrong answer for this question. Please free feel to express your opinion.] Visual C++ Programming Penn Wu, PhD 346

27 Be sure to use proper college level of writing. Do not use texting language. Visual C++ Programming Penn Wu, PhD 347

#using <System.dll> #using <System.Windows.Forms.dll> using namespace System; using namespace System::Windows::Forms;

#using <System.dll> #using <System.Windows.Forms.dll> using namespace System; using namespace System::Windows::Forms; Lecture #13 Introduction Exception Handling The C++ language provides built-in support for handling anomalous situations, known as exceptions, which may occur during the execution of your program. Exceptions

More information

However, it is necessary to note that other non-visual-c++ compilers may use:

However, it is necessary to note that other non-visual-c++ compilers may use: Lecture #2 Anatomy of a C++ console program C++ Programming Basics Prior to the rise of GUI (graphical user interface) operating systems, such as Microsoft Windows, C++ was mainly used to create console

More information

Operating System x86 x64 ARM Windows XP Windows Server 2003 Windows Vista Windows Server 2008 Windows 7 Windows Server 2012 R2 Windows 8 Windows 10

Operating System x86 x64 ARM Windows XP Windows Server 2003 Windows Vista Windows Server 2008 Windows 7 Windows Server 2012 R2 Windows 8 Windows 10 Lecture #1 What is C++? What are Visual C++ and Visual Studio? Introducing Visual C++ C++ is a general-purpose programming language created in 1983 by Bjarne Stroustrup. C++ is an enhanced version of the

More information

#using <System.dll> #using <System.Windows.Forms.dll>

#using <System.dll> #using <System.Windows.Forms.dll> Lecture #8 Introduction.NET Framework Regular Expression A regular expression is a sequence of characters, each has a predefined symbolic meaning, to specify a pattern or a format of data. Social Security

More information

Table 1: Typed vs. Generic Codes Scenario Typed Generic Analogy Cash Only Multiply Payment Options. Customers must pay cash. No cash, no deal.

Table 1: Typed vs. Generic Codes Scenario Typed Generic Analogy Cash Only Multiply Payment Options. Customers must pay cash. No cash, no deal. Lecture #15 Overview Generics in Visual C++ C++ and all its descendent languages, such as Visual C++, are typed languages. The term typed means that objects of a program must be declared with a data type,

More information

Calling predefined. functions (methods) #using <System.dll> #using <System.dll> #using <System.Windows.Forms.dll>

Calling predefined. functions (methods) #using <System.dll> #using <System.dll> #using <System.Windows.Forms.dll> Lecture #5 Introduction Visual C++ Functions A C++ function is a collection of statements that is called and executed as a single unit in order to perform a task. Frequently, programmers organize statements

More information

Data Source. Application. Memory

Data Source. Application. Memory Lecture #14 Introduction Connecting to Database The term OLE DB refers to a set of Component Object Model (COM) interfaces that provide applications with uniform access to data stored in diverse information

More information

Term Object-Oriented Paradigm Real-life example Abstraction Class declaration, creation, and definition

Term Object-Oriented Paradigm Real-life example Abstraction Class declaration, creation, and definition Lecture #6 What is a class and what is an object? Object-Oriented Programming Assuming that the instructor found a new breed of bear and decided to name it Kuma. In an email, the instructor described what

More information

accessmodifier [static] returntype functionname(parameters) { } private string getdatetime() { } public void getdatetime() { }

accessmodifier [static] returntype functionname(parameters) { } private string getdatetime() { } public void getdatetime() { } Lecture #6 User-defined functions User-Defined Functions and Delegates All C# programs must have a method called Main(), which is the starting point for the program. Programmers can also add other methods,

More information

Car. Sedan Truck Pickup SUV

Car. Sedan Truck Pickup SUV Lecture #7 Introduction Inheritance, Composition, and Polymorphism In terms of object-oriented programming, inheritance is the ability that enables new classes to use the properties and methods of existing

More information

using System; using System.Windows.Forms; public class Example { public static void Main() { if (5 > 3) { MessageBox.Show("Correct!

using System; using System.Windows.Forms; public class Example { public static void Main() { if (5 > 3) { MessageBox.Show(Correct! Lecture #4 Introduction The if statement C# Selection Statements A conditional statement (also known as selection statement) is used to decide whether to do something at a special point, or to decide between

More information

#using <System.dll> #using <System.Windows.Forms.dll> #using <System.Drawing.dll>

#using <System.dll> #using <System.Windows.Forms.dll> #using <System.Drawing.dll> Lecture #9 Introduction Anatomy of Windows Forms application Hand-Coding Windows Form Applications Although Microsoft Visual Studio makes it much easier for developers to create Windows Forms applications,

More information

Class Library java.util Package. Bok, Jong Soon

Class Library java.util Package. Bok, Jong Soon Class Library java.util Package Bok, Jong Soon javaexpert@nate.com www.javaexpert.co.kr Enumeration interface An object that implements the Enumeration interface generates a series of elements, one

More information

Basic File Handling and I/O

Basic File Handling and I/O Lecture #11 Introduction File and Stream I/O The System::IO namespace Basic File Handling and I/O The term basic file handling and I/O in Visual C++ refers to various file operations including read from

More information

Date and Time Functions

Date and Time Functions Date and Time Functions Introduction If you are using these functions in conjunction with either the Now() or Now_() functions, be aware that the time zone returned is the one configured on the machine

More information

public class Animal // superclass { public void run() { MessageBox.Show("Animals can run!"); } }

public class Animal // superclass { public void run() { MessageBox.Show(Animals can run!); } } Lecture #8 What is inheritance? Inheritance and Polymorphism Inheritance is an important object-oriented concept. It allows you to build a hierarchy of related classes, and to reuse functionality defined

More information

Similarly, example of memory address of array and hash are: ARRAY(0x1a31d44) and HASH(0x80f6c6c) respectively.

Similarly, example of memory address of array and hash are: ARRAY(0x1a31d44) and HASH(0x80f6c6c) respectively. Lecture #9 What is reference? Perl Reference A Perl reference is a scalar value that holds the location of another value which could be scalar, arrays, hashes, or even a subroutine. In other words, a reference

More information

The following table distinguishes these access modifiers.

The following table distinguishes these access modifiers. Lecture #7 Introduction User-Defined Functions and Delegates In programming, a function is defined as named code block that can perform a specific task. Some programming languages make a distinction between

More information

Introduction to OOP with Java. Instructor: AbuKhleif, Mohammad Noor Sep 2017

Introduction to OOP with Java. Instructor: AbuKhleif, Mohammad Noor Sep 2017 Introduction to OOP with Java Instructor: AbuKhleif, Mohammad Noor Sep 2017 Lecture 03: Control Flow Statements: Selection Instructor: AbuKhleif, Mohammad Noor Sep 2017 Instructor AbuKhleif, Mohammad Noor

More information

Lesson:9 Working with Array and String

Lesson:9 Working with Array and String Introduction to Array: Lesson:9 Working with Array and String An Array is a variable representing a collection of homogeneous type of elements. Arrays are useful to represent vector, matrix and other multi-dimensional

More information

The Year argument can be one to four digits between 1 and Month is a number representing the month of the year between 1 and 12.

The Year argument can be one to four digits between 1 and Month is a number representing the month of the year between 1 and 12. The table below lists all of the Excel -style date and time functions provided by the WinCalcManager control, along with a description and example of each function. FUNCTION DESCRIPTION REMARKS EXAMPLE

More information

Agenda & Reading. VB.NET Programming. Data Types. COMPSCI 280 S1 Applications Programming. Programming Fundamentals

Agenda & Reading. VB.NET Programming. Data Types. COMPSCI 280 S1 Applications Programming. Programming Fundamentals Agenda & Reading COMPSCI 80 S Applications Programming Programming Fundamentals Data s Agenda: Data s Value s Reference s Constants Literals Enumerations Conversions Implicitly Explicitly Boxing and unboxing

More information

11th Annual NB (English) High School Programming Competition

11th Annual NB (English) High School Programming Competition 11th Annual NB (English) High School Programming Competition hosted by UNB Saint John Friday, May 12, 2017 Competition Problems TEAM Rules: 1. For each problem, your program must read from the standard

More information

DateTimePicker Control

DateTimePicker Control Controls Part 2 DateTimePicker Control Used for representing Date/Time information and take it as input from user. Date information is automatically created. Prevents wrong date and time input. Fundamental

More information

Using Microsoft Excel

Using Microsoft Excel Using Microsoft Excel Excel contains numerous tools that are intended to meet a wide range of requirements. Some of the more specialised tools are useful to only certain types of people while others have

More information

BCIS 3630 Dr. GUYNES SPRING 2018 TUESDAY SECTION [JAN version] GRADER COURSE WEBSITE

BCIS 3630 Dr. GUYNES SPRING 2018 TUESDAY SECTION [JAN version] GRADER   COURSE WEBSITE COURSE WEBSITE http://www.steveguynes.com/bcis3630/bcis3630/default.html Instructor: Dr. Guynes Office: BLB 312H Phone: (940) 565-3110 Office Hours: By Email Email: steve.guynes@unt.edu TEXTBOOK: Starting

More information

The following is a simple if statement. A later lecture will discuss if structures in details.

The following is a simple if statement. A later lecture will discuss if structures in details. Lecture #2 Introduction What s in a C# source file? C# Programming Basics With the overview presented in the previous lecture, this lecture discusses the language core of C# to help students build a foundation

More information

Type Description Example

Type Description Example Lecture #1 Introducing Visual C# Introduction to the C# Language and the.net Framework According to Microsoft, C# (pronounced C sharp ) is a programming language that is designed for building a variety

More information

C++ Data Types and Variables

C++ Data Types and Variables Lecture #3 Introduction C++ Data Types and Variables Data is a collection of facts, such as values, messages, or measurements. It can be numbers, words, measurements, observations or even just descriptions

More information

NCSS Statistical Software. The Data Window

NCSS Statistical Software. The Data Window Chapter 103 Introduction This chapter discusses the operation of the NCSS Data Window, one of the four main windows of the NCSS statistical analysis system. The other three windows are the Output Window,

More information

Quick Guide for the ServoWorks.NET API 2010/7/13

Quick Guide for the ServoWorks.NET API 2010/7/13 Quick Guide for the ServoWorks.NET API 2010/7/13 This document will guide you through creating a simple sample application that jogs axis 1 in a single direction using Soft Servo Systems ServoWorks.NET

More information

Adobe EchoSign Calculated Fields Guide

Adobe EchoSign Calculated Fields Guide Adobe EchoSign Calculated Fields Guide Version 1.0 Last Updated: May, 2013 Table of Contents Table of Contents... 2 Overview... 3 Calculated Fields Use-Cases... 3 Calculated Fields Basics... 3 Calculated

More information

Flexible CSV CDR Importer

Flexible CSV CDR Importer Edition: 1.0 Release date: August 17, 2016 Smile version: 6.0 Published by Inomial Pty Ltd Suite 801, 620 Bourke St, Melbourne, Vic 3000, Australia www.inomial.com +61 3 9663 3554 sales@inomial.com support@inomial.com

More information

Topic 7: Algebraic Data Types

Topic 7: Algebraic Data Types Topic 7: Algebraic Data Types 1 Recommended Exercises and Readings From Haskell: The craft of functional programming (3 rd Ed.) Exercises: 5.5, 5.7, 5.8, 5.10, 5.11, 5.12, 5.14 14.4, 14.5, 14.6 14.9, 14.11,

More information

Object oriented lab /second year / review/lecturer: yasmin maki

Object oriented lab /second year / review/lecturer: yasmin maki 1) Examples of method (function): Note: the declaration of any method is : method name ( parameters list ).. Method body.. Access modifier : public,protected, private. Return

More information

Python - Week 3. Mohammad Shokoohi-Yekta

Python - Week 3. Mohammad Shokoohi-Yekta Python - Week 3 Mohammad Shokoohi-Yekta 1 Objective To solve mathematic problems by using the functions in the math module To represent and process strings and characters To use the + operator to concatenate

More information

Flexible Rate Card Importer

Flexible Rate Card Importer Edition: 1.0 Release date: August 23, 2016 Smile version: 6.0 Published by Inomial Pty Ltd Suite 801, 620 Bourke St, Melbourne, Vic 3000, Australia www.inomial.com +61 3 9663 3554 sales@inomial.com support@inomial.com

More information

Configuring Log Parsers Step-by-Step Quick Start Guide April 24, 2008

Configuring Log Parsers Step-by-Step Quick Start Guide April 24, 2008 Configuring Log Parsers Step-by-Step Quick Start Guide April 24, 2008 About Kaseya Kaseya is a global provider of IT automation software for IT Solution Providers and Public and Private Sector IT organizations.

More information

Programming Assignment #2

Programming Assignment #2 Programming Assignment #2 Due: 11:59pm, Wednesday, Feb. 13th Objective: This assignment will provide further practice with classes and objects, and deepen the understanding of basic OO programming. Task:

More information

Unit 16: More Basic Activities

Unit 16: More Basic Activities Unit 16: More Basic Activities BPEL Fundamentals This is Unit #16 of the BPEL Fundamentals course. In past Units we ve looked at ActiveBPEL Designer, Workspaces and Projects, created the Process itself

More information

Programming Date and Time APIs

Programming Date and Time APIs System i Programming Date and Time APIs Version 6 Release 1 System i Programming Date and Time APIs Version 6 Release 1 Note Before using this information and the product it supports, read the information

More information

IVI-3.18: IVI.NET Utility Classes and Interfaces Specification

IVI-3.18: IVI.NET Utility Classes and Interfaces Specification IVI Interchangeable Virtual Instruments IVI-3.18: IVI.NET Utility Classes and Interfaces Specification February 26, 2016 Edition Revision 1.3 Important Information Warranty Trademarks The IVI.NET Utility

More information

1. Introduction to Microsoft Excel

1. Introduction to Microsoft Excel 1. Introduction to Microsoft Excel A spreadsheet is an online version of an accountant's worksheet, which can automatically do most of the calculating for you. You can do budgets, analyze data, or generate

More information

MagicListbox Description. MagicListbox. A Listbox Component from Simon Berridge RealStudio 2011 R4.3.

MagicListbox Description. MagicListbox. A Listbox Component from Simon Berridge RealStudio 2011 R4.3. MagicListbox A Listbox Component from Simon Berridge simberr@gmail.com RealStudio 2011 R4.3 Page 1 of 12 Table of Contents Introduction! 4 New Properties! 5 Property List Editor Properties! 5 TableType

More information

Configuring Log Parsers Step-by-Step Quick Start Guide September 10, 2009

Configuring Log Parsers Step-by-Step Quick Start Guide September 10, 2009 Configuring Log Parsers Step-by-Step Quick Start Guide September 10, 2009 About Kaseya Kaseya is a global provider of IT automation software for IT Solution Providers and Public and Private Sector IT organizations.

More information

Using Custom Number Formats

Using Custom Number Formats APPENDIX B Using Custom Number Formats Although Excel provides a good variety of built-in number formats, you may find that none of these suits your needs. This appendix describes how to create custom

More information

Tivoli Common Reporting V2.x. Reporting with Client s Time zone

Tivoli Common Reporting V2.x. Reporting with Client s Time zone Tivoli Common Reporting V2.x Reporting with Client s Time zone Preethi C Mohan IBM India Ltd. India Software Labs, Bangalore +91 80 40255077 preethi.mohan@in.ibm.com Copyright IBM Corporation 2013 This

More information

Chapter 14. Additional Topics in C# 2010 The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill

Chapter 14. Additional Topics in C# 2010 The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Chapter 14 Additional Topics in C# McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved. Chapter Objectives - 1 Validate user input in the Validating event handler and display messages

More information

A USER S GUIDE TO THE NPL TELEPHONE TIME SERVICE

A USER S GUIDE TO THE NPL TELEPHONE TIME SERVICE A USER S GUIDE TO THE NPL TELEPHONE TIME SERVICE Contents 1. NPL s Computer Time Services 2. How to use the NPL Telephone Time Service 3. Additional information about the service 4. Contacting NPL Appendix

More information

Chapter 9 Lab Text Processing and Wrapper Classes

Chapter 9 Lab Text Processing and Wrapper Classes Lab Objectives Chapter 9 Lab Text Processing and Wrapper Classes Use methods of the Character class and String class to process text Be able to use the StringTokenizer and StringBuffer classes Introduction

More information

CPR III Manual TABLE OF CONTENTS

CPR III Manual TABLE OF CONTENTS # CPR III Manual TABLE OF CONTENTS 1. Add / Edit Groups 2. Add / Edit Locations 3. Add / Edit Day Plan Steps 4. Add / Edit Annual Plans 5. Display Today s Plan 6. Program Override 7. Manual Control 8.

More information

CSC-140 Assignment 6

CSC-140 Assignment 6 CSC-140 Assignment 6 1 Introduction In this assignment we will start out defining our own classes. For now, we will design a class that represents a date, e.g., Tuesday, March 15, 2011, or in short hand

More information

Quick Reference Guide. Online Courier: File Transfer Protocol (FTP) Signing On. Using FTP Pickup

Quick Reference Guide. Online Courier: File Transfer Protocol (FTP) Signing On. Using FTP Pickup Quick Reference Guide Online Courier: File Transfer Protocol (FTP) With SunTrust Online Courier, you can have reports and files delivered to you using a File Transfer Protocol (FTP) connection. There are

More information

Visual C# Program: Simple Game 3

Visual C# Program: Simple Game 3 C h a p t e r 6C Visual C# Program: Simple Game 3 In this chapter, you will learn how to use the following Visual C# Application functions to World Class standards: Opening Visual C# Editor Beginning a

More information

CSE 113 A. Announcements - Lab

CSE 113 A. Announcements - Lab CSE 113 A February 21-25, 2011 Announcements - Lab Lab 1, 2, 3, 4; Practice Assignment 1, 2, 3, 4 grades are available in Web-CAT look under Results -> Past Results and if looking for Lab 1, make sure

More information

Genesys Info Mart. date-time Section

Genesys Info Mart. date-time Section Genesys Info Mart date-time Section 11/27/2017 date-time Section date-time-max-days-ahead date-time-min-days-ahead date-time-start-year date-time-table-name date-time-tz first-day-of-week fiscal-year-start

More information

Date & Time Handling In JAVA

Date & Time Handling In JAVA Date & Time Handling In JAVA Sisoft Technologies Pvt Ltd SRC E7, Shipra Riviera Bazar, Gyan Khand-3, Indirapuram, Ghaziabad Website: www.sisoft.in Email:info@sisoft.in Phone: +91-9999-283-283 1 Date and

More information

Final Exam Review April 18, 2018

Final Exam Review April 18, 2018 Engr 123 Name Final Exam Review April 18, 2018 Final Exam is Monday April 30, 2018 at 8:00am 1. If i, j, and k are all of type int and i = 0, j = 2, and k = -8, mark whether each of the following logical

More information

A USER'S GUIDE TO THE NPL TELEPHONE TIME SERVICE

A USER'S GUIDE TO THE NPL TELEPHONE TIME SERVICE A USER'S GUIDE TO THE NPL TELEPHONE TIME SERVICE Contents 1. NPL's Computer Time Services 2. How to use the NPL Telephone Time Service 3. Additional information about the service 4. Contacting NPL Appendix

More information

CS313T ADVANCED PROGRAMMING LANGUAGE

CS313T ADVANCED PROGRAMMING LANGUAGE CS313T ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 1 : Introduction Lecture Contents 2 Course Info. Course objectives Course plan Books and references Assessment methods and grading

More information

You must pass the final exam to pass the course.

You must pass the final exam to pass the course. Computer Science Technology Department Houston Community College System Department Website: http://csci.hccs.cc.tx.us CRN: 46876 978-1-4239-0146-4 1-4239-0146-0 Semester: Fall 2010 Campus and Room: Stafford

More information

EnableBasic. The Enable Basic language. Modified by Admin on Sep 13, Parent page: Scripting Languages

EnableBasic. The Enable Basic language. Modified by Admin on Sep 13, Parent page: Scripting Languages EnableBasic Old Content - visit altium.com/documentation Modified by Admin on Sep 13, 2017 Parent page: Scripting Languages This Enable Basic Reference provides an overview of the structure of scripts

More information

Table of Contents 1 Basic Configuration Commands 1-1

Table of Contents 1 Basic Configuration Commands 1-1 Table of Contents 1 Basic Configuration Commands 1-1 Basic Configuration Commands 1-1 clock datetime 1-1 clock summer-time one-off 1-2 clock summer-time repeating 1-3 clock timezone 1-4 configure-user

More information

Clock Commands. Cisco IOS XR System Management Command Reference for the Cisco CRS Router, Release 4.2.x 1

Clock Commands. Cisco IOS XR System Management Command Reference for the Cisco CRS Router, Release 4.2.x 1 This module describes the commands used to set and display the internal clock settings in Cisco IOS XR software. For more information about manually setting the router clock, see Cisco IOS XR Getting Started

More information

ISO8601. Time.ISO8601. Time.ISO8601

ISO8601. Time.ISO8601. Time.ISO8601 Time.ISO8601 ISO8601 This collection of classes attempts to implement the ISO 8601 time standard. Here you'll find representations of time, dates, time with dates, spans of time and methods of manipulating

More information

King Abdulaziz University Faculty of Computing and Information Technology Computer Science Department

King Abdulaziz University Faculty of Computing and Information Technology Computer Science Department King Abdulaziz University Faculty of Computing and Information Technology Computer Science Department CPCS202, 1 st Term 2016 (Fall 2015) Program 5: FCIT Grade Management System Assigned: Thursday, December

More information

Clock Commands on the Cisco IOS XR Software

Clock Commands on the Cisco IOS XR Software Clock Commands on the Cisco IOS XR Software This module describes the commands used to set and display the internal clock settings in Cisco IOS XR software. For more information about manually setting

More information

Clock Commands on the Cisco IOS XR Software

Clock Commands on the Cisco IOS XR Software This module describes the commands used to set and display the internal clock settings in Cisco IOS XR software. For more information about manually setting the router clock, see Cisco IOS XR Getting Started

More information

Discover how to get up and running with the Java Development Environment and with the Eclipse IDE to create Java programs.

Discover how to get up and running with the Java Development Environment and with the Eclipse IDE to create Java programs. Java SE11 Development Java is the most widely-used development language in the world today. It allows programmers to create objects that can interact with other objects to solve a problem. Explore Java

More information

Payflow Implementer's Guide FAQs

Payflow Implementer's Guide FAQs Payflow Implementer's Guide FAQs FS-PF-FAQ-UG-201702--R016.00 Fairsail 2017. All rights reserved. This document contains information proprietary to Fairsail and may not be reproduced, disclosed, or used

More information

Visual Basic/C# Programming (330)

Visual Basic/C# Programming (330) Page 1 of 12 Visual Basic/C# Programming (330) REGIONAL 2017 Production Portion: Program 1: Calendar Analysis (400 points) TOTAL POINTS (400 points) Judge/Graders: Please double check and verify all scores

More information

IBSDK Quick Start Tutorial for C# 2010

IBSDK Quick Start Tutorial for C# 2010 IB-SDK-00003 Ver. 3.0.0 2012-04-04 IBSDK Quick Start Tutorial for C# 2010 Copyright @2012, lntegrated Biometrics LLC. All Rights Reserved 1 QuickStart Project C# 2010 Example Follow these steps to setup

More information

Clock Commands. Cisco IOS XR System Management Command Reference for the Cisco XR Series Router, Release 4.3.x OL

Clock Commands. Cisco IOS XR System Management Command Reference for the Cisco XR Series Router, Release 4.3.x OL This module describes the commands used to set and display the internal clock settings in Cisco IOS XR software. For more information about manually setting the router clock, see Cisco IOS XR Getting Started

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

Atomic Time Manager 400 Product Documentation

Atomic Time Manager 400 Product Documentation Atomic Time Manager 400 Product Documentation Version 1.2.3 March 24, 2004 Copyright 2003-2004, Client Server Development, Inc. and Davis Software Services, Inc. All Rights Reserved 1. Introduction...4

More information

Programming Project 5: NYPD Motor Vehicle Collisions Analysis

Programming Project 5: NYPD Motor Vehicle Collisions Analysis : NYPD Motor Vehicle Collisions Analysis Due date: Dec. 7, 11:55PM EST. You may discuss any of the assignments with your classmates and tutors (or anyone else) but all work for all assignments must be

More information

CS 116. Lab Assignment # 1 1

CS 116. Lab Assignment # 1 1 Points: 2 Submission CS 116 Lab Assignment # 1 1 o Deadline: Friday 02/05 11:59 PM o Submit on Blackboard under assignment Lab1. Please make sure that you click the Submit button and not just Save. Late

More information

DATABASE AUTOMATION USING VBA (ADVANCED MICROSOFT ACCESS, X405.6)

DATABASE AUTOMATION USING VBA (ADVANCED MICROSOFT ACCESS, X405.6) Technology & Information Management Instructor: Michael Kremer, Ph.D. Database Program: Microsoft Access Series DATABASE AUTOMATION USING VBA (ADVANCED MICROSOFT ACCESS, X405.6) AGENDA 3. Executing VBA

More information

The Irving K. Barber School of Arts and Sciences COSC 111 Final Exam Winter Term II Instructor: Dr. Bowen Hui. Tuesday, April 19, 2016

The Irving K. Barber School of Arts and Sciences COSC 111 Final Exam Winter Term II Instructor: Dr. Bowen Hui. Tuesday, April 19, 2016 First Name (Print): Last Name (Print): Student Number: The Irving K. Barber School of Arts and Sciences COSC 111 Final Exam Winter Term II 2016 Instructor: Dr. Bowen Hui Tuesday, April 19, 2016 Time: 6:00pm

More information

Computers, Variables and Types. Engineering 1D04, Teaching Session 2

Computers, Variables and Types. Engineering 1D04, Teaching Session 2 Computers, Variables and Types Engineering 1D04, Teaching Session 2 Typical Computer Copyright 2006 David Das, Ryan Lortie, Alan Wassyng 1 An Abstract View of Computers Copyright 2006 David Das, Ryan Lortie,

More information

Scheduling. Scheduling Tasks At Creation Time CHAPTER

Scheduling. Scheduling Tasks At Creation Time CHAPTER CHAPTER 13 This chapter explains the scheduling choices available when creating tasks and when scheduling tasks that have already been created. Tasks At Creation Time The tasks that have the scheduling

More information

Data Types and Expressions

Data Types and Expressions 2 Data Types and Expressions C# Programming: From Problem Analysis to Program Design C# Programming: From Problem Analysis to Program Design 1 4th Edition Chapter Objectives C# Programming: From Problem

More information

Mr.Khaled Anwar ( )

Mr.Khaled Anwar ( ) The Rnd() function generates random numbers. Every time Rnd() is executed, it returns a different random fraction (greater than or equal to 0 and less than 1). If you end execution and run the program

More information

Skinning Manual v1.0. Skinning Example

Skinning Manual v1.0. Skinning Example Skinning Manual v1.0 Introduction Centroid Skinning, available in CNC11 v3.15 r24+ for Mill and Lathe, allows developers to create their own front-end or skin for their application. Skinning allows developers

More information

Introduction to Typed Racket. The plan: Racket Crash Course Typed Racket and PL Racket Differences with the text Some PL Racket Examples

Introduction to Typed Racket. The plan: Racket Crash Course Typed Racket and PL Racket Differences with the text Some PL Racket Examples Introduction to Typed Racket The plan: Racket Crash Course Typed Racket and PL Racket Differences with the text Some PL Racket Examples Getting started Find a machine with DrRacket installed (e.g. the

More information

Session 5.2. Creating Clocks

Session 5.2. Creating Clocks 1 Session 5.2 Creating Clocks Chapter 5.2: Creating Clocks 2 Session Overview Find out how to obtain and use the current date and time in a C# program using the DateTime type Discover how to extract a

More information

Tutorial 19 - Microwave Oven Application Building Your Own Classes and Objects

Tutorial 19 - Microwave Oven Application Building Your Own Classes and Objects 1 Tutorial 19 - Microwave Oven Application Building Your Own Classes and Objects Outline 19.1 Test-Driving the Microwave Oven Application 19.2 Designing the Microwave Oven Application 19.3 Adding a New

More information

Comindware Expression Language

Comindware Expression Language Comindware Expression Language Reference Guide 2013 Comindware Inc. Copyright Comindware, 2009-2013. All rights reserved. Comindware, Comindware Task Management, Comindware Tracker are registered trademarks

More information

Session Administration System Upload & Download Utilities

Session Administration System Upload & Download Utilities Session Administration System Upload & Download Utilities The Elluminate Live! Session Administration System (SAS) offers a great deal of flexibility to both corporate and educational clients. It provides

More information

LECTURE NOTES ON PROGRAMMING FUNDAMENTAL USING C++ LANGUAGE

LECTURE NOTES ON PROGRAMMING FUNDAMENTAL USING C++ LANGUAGE Department of Software The University of Babylon LECTURE NOTES ON PROGRAMMING FUNDAMENTAL USING C++ LANGUAGE By Collage of Information Technology, University of Babylon, Iraq Samaher_hussein@yahoo.com

More information

************ THIS PROGRAM IS NOT ELIGIBLE FOR LATE SUBMISSION. ALL SUBMISSIONS MUST BE RECEIVED BY THE DUE DATE/TIME INDICATED ABOVE HERE

************ THIS PROGRAM IS NOT ELIGIBLE FOR LATE SUBMISSION. ALL SUBMISSIONS MUST BE RECEIVED BY THE DUE DATE/TIME INDICATED ABOVE HERE Program 10: 40 points: Due Tuesday, May 12, 2015 : 11:59 p.m. ************ THIS PROGRAM IS NOT ELIGIBLE FOR LATE SUBMISSION. ALL SUBMISSIONS MUST BE RECEIVED BY THE DUE DATE/TIME INDICATED ABOVE HERE *************

More information

Call DLL from Limnor Applications

Call DLL from Limnor Applications Call DLL from Limnor Applications There is a lot of computer software in the format of dynamic link libraries (DLL). DLLCaller performer allows your applications to call DLL functions directly. Here we

More information

Formatting cells. Microsoft Excel Cell alignment. Format cells options

Formatting cells. Microsoft Excel Cell alignment. Format cells options Formatting cells Microsoft Excel 2003 Cell alignment 1. Select a cell or cells that you wish to apply alignment 2. Click Left, Centre or Right alignment. Left, Centre, Right Format cells options 1. Highlight

More information

KOMAR UNIVERSITY OF SCIENCE AND TECHNOLOGY (KUST)

KOMAR UNIVERSITY OF SCIENCE AND TECHNOLOGY (KUST) Programming Concepts & Algorithms Course Syllabus Course Title Course Code Computer Department Pre-requisites Course Code Course Instructor Programming Concepts & Algorithms + lab CPE 405C Computer Department

More information

Extending Ninox with NX

Extending Ninox with NX Introduction Extending Ninox with NX NX, the Ninox query language, is a powerful programming language which allows you to quickly extend Ninox databases with calculations and trigger actions. While Ninox

More information

Time. Computer Science and Engineering College of Engineering The Ohio State University. Lecture 37

Time. Computer Science and Engineering College of Engineering The Ohio State University. Lecture 37 Time Computer Science and Engineering College of Engineering The Ohio State University Lecture 37 Interval vs Point Different questions: How long did it take to run 5k? When is our final exam? Answering

More information

Lab 3: Call to Order CSCI 2101 Fall 2018

Lab 3: Call to Order CSCI 2101 Fall 2018 Due: Monday, October 15, 11:59 pm Collaboration Policy: Level 1 Group Policy: Pair-Optional Lab 3: Call to Order CSCI 2101 Fall 2018 This week s lab will explore sorting, lists, and basic data analysis.

More information

CSE115 / CSE503 Introduction to Computer Science I Dr. Carl Alphonce 343 Davis Hall Office hours:

CSE115 / CSE503 Introduction to Computer Science I Dr. Carl Alphonce 343 Davis Hall Office hours: CSE115 / CSE503 Introduction to Computer Science I Dr. Carl Alphonce 343 Davis Hall alphonce@buffalo.edu Office hours: Tuesday 10:00 AM 12:00 PM * Wednesday 4:00 PM 5:00 PM Friday 11:00 AM 12:00 PM OR

More information

Lab 3: Call to Order CSCI 2101 Fall 2017

Lab 3: Call to Order CSCI 2101 Fall 2017 Lab 3: Call to Order CSCI 2101 Fall 2017 Due: Part 1: Tuesday, Oct 3, 11:59 pm, Part 2: Wednesday, Oct 11, 11:59 pm Collaboration Policy: Level 1 Group Policy: Part 1: Individual, Part 2: Pair-Optional

More information

AIMMS Function Reference - Date Time Related Identifiers

AIMMS Function Reference - Date Time Related Identifiers AIMMS Function Reference - Date Time Related Identifiers This file contains only one chapter of the book. For a free download of the complete book in pdf format, please visit www.aimms.com Aimms 3.13 Date-Time

More information