-
Notifications
You must be signed in to change notification settings - Fork 3
kiwi.time.Calendar
Nikos Siatras edited this page Sep 28, 2022
·
19 revisions
The Calendar object provides methods for converting between a specific instant in time and a set of fields calendar fields such as YEAR, MONTH, DAY_OF_MONTH, HOUR, and so on, and for manipulating the calendar fields, such as getting the date of the next week. An instant in time can be represented by a millisecond value that is an offset from midnight (00:00:00) January 1, 1970 00:00:00.000 Coordinated Universal Time (UTC)
Method | Description |
---|---|
Calendar.getTime() | Returns a Date object representing this Calendar's current time value . |
Calendar.getTimeInMillis() | Returns this Calendar's current time value in milliseconds. |
Calendar.createTime(timeInUTCMillis as LongInt) | Creates and return's a DateTime object according to the given time in milliseconds elapsed since midnight (00:00:00), January 1st, 1970, Coordinated Universal Time (UTC) and the Calendar's TimeZone. |
#include once "kiwi\kiwi.bi"
#include once "kiwi\time.bi"
' Print computer's clock timezone
Dim utcOffset as Integer = RealTimeClock.getUTCTimeZone()
print "System's Time Zone: UTC " & iif(utcOffset>0 ,"+" & abs(utcOffset) , "-" & abs(utcOffset))
print ""
' Print UTC Time
Dim utcTime as DateTime = DateTime(System.currentTimeMillis())
print "UTC Time: " & utcTime.toString()
' Create a calendar with computer's Time Zone and
' print computer's date time
Dim systemCalendar as Calendar = Calendar(RealTimeClock.getUTCTimeZone())
Dim computerTime as DateTime = systemCalendar.getTime()
print "Computer's Time: " & computerTime.toString()
' Create a calendar with Athens/Greece UTC+3 time zone
' and print date time of Athens/Greece
Dim athensGreeceCalendar as Calendar = Calendar(+3) '+3 UTC Time Zone
Dim timeInGreece as DateTime = athensGreeceCalendar.getTime()
print "Time in Athens/Greece: " & timeInGreece.toString()
' Create a calendar with Berlin/Germany UTC+2 time zone
' and print date time of Berlin/Germany
Dim londonCalendar as Calendar = Calendar(+2) '+2 UTC Time Zone
Dim timeInLondon as DateTime = londonCalendar.getTime()
print "Time in Berlin/Germany: " & timeInLondon.toString()
- MySQL/MariaDB - Coming to v1.0.2
- ArrayList
- Comparator
- HashMap - Coming to v1.0.2
- Queue