Ruby | DateTime jd() function Last Updated : 09 Jan, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report DateTime#jd() : jd() is a DateTime class method which returns a DateTime object denoting the given chronological Julian day number. Syntax: DateTime.jd() Parameter: DateTime values Return: DateTime object denoting the given chronological Julian day number. Example #1 : Ruby # Ruby code for DateTime.jd() method # loading library require 'date' # declaring DateTime value date_a = DateTime.jd(25351944) # declaring DateTime value date_b = DateTime.jd(4678364) # jd method puts "DateTime jd form : #{date_a}\n\n" puts "DateTime jd form : #{date_b}\n\n" Output : DateTime jd form : 64699-03-01T00:00:00+00:00 DateTime jd form : 8096-10-27T00:00:00+00:00 Example #2 : Ruby # Ruby code for DateTime.jd() method # loading library require 'date' # declaring DateTime value date_a = DateTime.jd(287585851944) # declaring DateTime value date_b = DateTime.jd(Rational('0.5')) # jd method puts "DateTime jd form : #{date_a}\n\n" puts "DateTime jd form : #{date_b}\n\n" Output : DateTime jd form : 787378607-01-18T00:00:00+00:00 DateTime jd form : -4712-01-01T12:00:00+00:00 Comment More infoAdvertise with us Next Article Ruby | DateTime parse() function M mayank5326 Follow Improve Article Tags : Ruby Ruby-Methods Ruby DateTime-class Similar Reads Ruby | DateTime new() function DateTime#new() : new() is a DateTime class method which returns a DateTime object denoting the given calendar date. Syntax: DateTime.new() Parameter: DateTime values Return: a DateTime object denoting the given calendar date. Example #1 : Ruby # Ruby code for DateTime.new() method # loading library 2 min read Ruby | DateTime now() function DateTime#now() : now() is a DateTime class method which returns a DateTime object denoting the given calendar date. Syntax: DateTime.now() Parameter: DateTime values Return: DateTime object denoting the given calendar date. Example #1 : Ruby # Ruby code for DateTime.now() method # loading library re 1 min read Ruby | DateTime hour() function DateTime#hour() : hour() is a DateTime class method which returns the hours i.e. from 0 to 23 from the given DateTime object. Syntax: DateTime.hour() Parameter: DateTime values Return: hours i.e. from 0 to 23 from the given DateTime object Example #1 : Ruby # Ruby code for DateTime.hour() method # l 2 min read Ruby | DateTime parse() function DateTime#parse() : parse() is a DateTime class method which parses the given representation of date and time, and creates a DateTime object. Syntax: DateTime.parse() Parameter: DateTime values Return: given representation of date and time, and creates a DateTime object. Example #1 : Ruby # Ruby code 1 min read Ruby | DateTime ordinal() function DateTime#ordinal() : ordinal() is a DateTime class method which returns a DateTime object denoting the given ordinal date. Syntax: DateTime.ordinal() Parameter: DateTime values Return: a DateTime object denoting the given ordinal date. Example #1 : Ruby # Ruby code for DateTime.ordinal() method # lo 1 min read Ruby | DateTime jisx0301() function DateTime#jisx0301() : jisx0301() is a DateTime class method which returns the jisx0301 standard for the given DateTime object. Syntax: DateTime.jisx0301() Parameter: DateTime values Return: jisx0301 standard for the given DateTime object. Example #1 : Ruby # Ruby code for DateTime.jisx0301() method 2 min read Like