Ejemplo n.º 1
0
int main()
{
	// create object
	Date myDate(12, 15, 1987);
	// display date 
	myDate.displayDate();

	return 0;
}
Ejemplo n.º 2
0
Date
Date::getDate(std::string arg, bool isFormatted)
{
    // isFormatted=true for formatted value like 20010102.5*/
    Date myDate(*this);

    if( ! myDate.setDate(arg) )
    {
        if( isFormatted )
            myDate.setFormattedDate();

        if( myDate.isFormattedDate )
            myDate.setDate( hdhC::string2Double(arg) );
        else if( ! isDateSet )
            myDate.jul=hdhC::string2Double(arg);
        else
            myDate.addTime(hdhC::string2Double(arg));
    }

    return myDate ;
}
Ejemplo n.º 3
0
Date
Date::getDate( double val, bool isJulDay)
{
    // If val is relative to a reference date set before, then
    // the ISO-8601 format of the realative date is returned.

    // If a reference is not set, then val is considered a Julian day.

    // The bool set true states that val is a Julian day.
    Date myDate(*this);

    if( isFormattedDate )
        myDate.setDate(val);
    else if( isJulDay )
        // representation of the current julian day
        myDate.jul=val;
    else
        myDate.addTime(val);

    return myDate;
}
Ejemplo n.º 4
0
int main()
{
	Date myDate(0,0,0);

	myDate.showDate();

	myDate.setYear(2013);

	myDate.setMonth(6);

	myDate.setDay(8);

	myDate.showDate();

	myDate.setDate(2013, 8, 32);

	myDate.showDate();

	myDate.addDay();

	myDate.showDate();

	return 0;
}