Ring Documentation Walkthrough #9 – Date and Time

We’ll talk in this chapter about the Date and Time in Ring and its functions.

Let’s start.


clock():

We use this function to know how long the program spent running.

for x = 1 to 1000000
   see clock() + nl
next
#output: milliseconds in each line.

time():

We can get the local system time using this function.

for x = 1 to 1000000
   see time() + nl
next

date():

We can get the local date with this. The format is dd/mm/yyyy

see date()

timelist():

This one returns a list of date and time information.

see timelist()

This table shows you index of each info.

  • 1 – Abbreviated weekday name.
  • 2 – Full weekday name.
  • 3 – Abbreviated month name.
  • 4 – Full month name.
  • 5 – Date & Time.
  • 6 – Day of the month.
  • 7 – Hour in 24 format.
  • 8 – Hour in 12 format.
  • 9 – Day of the year.
  • 10 – Month of the year.
  • 11 – Current minutes.
  • 12 – AM or PM.
  • 13 – Current seconds.
  • 14 – Week of the year.
  • 15 – Day of the week.
  • 16 – Date.
  • 17 – Time.
  • 18 – Year of the century.
  • 19 – Year.
  • 20 – Timezone.
  • 21 – Percent sign.

Example:

see timelist()[2] + nl #output: Full weekday name.
see timelist()[19] + nl #output: Year.
see timelist()[6] + nl #output: Day of the month.

addays() & diffdays():

see 'Current date : ' + date() + nl #output: 13/02/2016
see 'After 10 days : ' + adddays( date(), 10 ) #output: 23/02/2016

Date1 = date()
Date2 = adddays(Date1, 10)

see diffdays(Date1, Date2) #output: Date1 - Date 2 = -10
see diffdays(Date2, Date1) #output: Date2 - Date1 = 10

This is pretty much the date and time in Ring.

See you in the next chapter.

amrESSAM.

Advertisements
Ring Documentation Walkthrough #9 – Date and Time

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s