Date :: assign - Set date value
The function provides different ways for setting a date value.
The date contains day, month and year, but not the time.
Implementation overview
- Create an empty data value
Date :: assign (  ) - Copy date value
Date :: assign ( cDate ) - Set date from number of days
Date :: assign ( iDays ) - Create date value from day, month and year
Date :: assign ( iDay, iMonth, iYear ) - Set local date value from unix timestamp
Date :: assign ( iUnixTime, bLocalTime ) - Set date value from string
Date :: assign ( sDate ) - Set ODABA date value from unix timestamp
Date :: assign ( iUnixTime )
Implementation details
-
Create an empty data value
odaba::Date & Date  :: assign (  )
The function initializes date to the current date.
to list
-
Copy date value
odaba::Date & Date  :: assign ( odaba::Date &cDate )
The function copies the date value passed in cDate.
- cDate
- Date
The date contains day, month and year, but not the time.
to list
- cDate
- Date
-
Set date from number of days
odaba::Date & Date  :: assign ( int32 iDays )
The function sets the date value to the date, which corresponds to the number of days since 1.1.1870.
- iDays
- Set date from days
The function calculates the date from the number of days passed in iDays. The value must be greater than 0.
to list
- iDays
- Set date from days
-
Create date value from day, month and year
odaba::Date & Date  :: assign ( int32 iDay, int32 iMonth, int32 iYear )
The function creates an ODABA date for the day, month and year passed in iDay, iMonth and iYear.
- iDay
- Day
Day of the month according to the Gregorian Calendar.
- iMonth
- Month
Month of the year according to the Gregorian Calendar.
- iYear
- Year
Number of the year (AD).
to list
- iDay
- Day
-
Set local date value from unix timestamp
odaba::Date & Date  :: assign ( int64 iUnixTime, bool bLocalTime )
The Unix timestamp, which is passed in iUnixTime, contains the number of seconds since 1.1.1970 0:00:00 (UTC). The Unix timestamp is supposed to contain a standard time value (UTC).
When true has been passed in bLocalTime, the timestamp will be adjusted to local time before being converted into an ODABA date value ignoring the time in the timestamp value.
When false has been passed in bLocalTime, the timestamp is supposed to contain standard time value (UTC) or the application is responsible for proper interpretation.
- iUnixTime
- Unix time stamp
The unix timestamp contains the number of seconds since 1.1.1970 0:00:00 (UTC), which is an absolute timestamp that might be converted into local time.
- bLocalTime
- Local or standard time
The option indicates, that a time value or timestamp contains local time (true) or Greenwich standard time (false).
to list
- iUnixTime
- Unix time stamp
-
Set date value from string
odaba::Date & Date  :: assign ( odaba::String &sDate )
The function sets the date value from the string date passed in sDate. When no date format has been set, the date format is detected automatically from string value as follows:
- contains '.' - DD.MM.YYYY or DD.MM.YY
- contains '/' - MM/DD/YYYY or MM/DD/YY
- contains '-' - YYYY-MM-DD or YY-MM-DD
- else - YYYYMMDD or YYMMDD
- sDate
- Date value in string format
Date values can be passed in different ways as string value:
Standard: yyyy-mm-dd or yyyymmdd
English: mm/dd/yyyy
German: dd.mm.yyyy
The type of date is determined from the separator used.
to list
-
Set ODABA date value from unix timestamp
odaba::Date & Date  :: assign ( int64 iUnixTime )
The Unix timestamp, which is passed in iUnixTime, contains the number of seconds since 1.1.1970 0:00:00.
The Unix time stamp is converted into an ODABA date value ignoring the day time stored in the timestamp. It is up to the application interpreting the value as local or standard time.
- iUnixTime
- Unix time stamp
The unix timestamp contains the number of seconds since 1.1.1970 0:00:00 (UTC), which is an absolute timestamp that might be converted into local time.
to list
- iUnixTime
- Unix time stamp