Learn and Learn

Learn And Learn - great place for tutorials, references and how-to

Ruby – Set jisx0301 Date Format – jisx0301() Method – Examples & Explanation

The jisx0301 method generates a new Date object by explaining from a string given in a code according to some typical JISX 0301 formats.

jisx0301() Method in Ruby

jisx0301() method exists in Standard Date Library of Ruby. The purpose of this method is to generates a new Date object by explaining from a string given in a code

 

Syntax of the jisx0301() Method in Ruby

In date, the syntax of jisx0301() method is:

 

Parameter of jisx0301() Method in Ruby

The parameter x is any valid jisx0301 format date object in the form of string. This parameter is required.Note: If the x parameter is not a valid jisx0301 format date object or zero jisx0301() method will return an error.

 

Return Value of jisx0301()

jisx0301() method will return a new Date object by explaining from a string given in a code.

 

Explaining jisx0301() Year format

The jisx0301() year format is start with a ‘H10’ which represents the year 01-01-1998 and is continue to ‘H99’ which represents the year 12-31-2087. The notable thing is the ‘H’ in this format is not case sensitive.

 

Ruby jisx0301() Example 1


Output
2015-01-01

 

Ruby jisx0301() Example 2


Output
2016-12-31

 

Ruby jisx0301() Example 3


Output
2023-11-21

 

Ruby jisx0301() Example 4


Output
2028-11-21

 

LearnAndLearn.com © 2018 - All rights reserved