Ruby | Time now() function
The now() is an inbuilt method in Ruby returns the current time.
Syntax: time.now()
Parameters: The function accepts no parameter
Return Value: It returns the current time
Example 1:
# Ruby code for now() method # Include Time require 'time' # Declaring time a = Time.now() # Prints current time puts a |
Output:
2019-08-27 08:26:42 +0000
Example 2:
# Ruby code for now() method # Include Time require 'time' # Declaring time a = Time.now() # Prints current time puts a |
Output:
2019-08-27 08:26:42 +0000