Return the last 2 digits a number

后端 未结 6 1032
Happy的楠姐
Happy的楠姐 2021-01-11 15:00

How can I get the last 2 digits of:

200912

to my object:

$year = $flightDates-&         


        
6条回答
  •  盖世英雄少女心
    2021-01-11 15:25

    convert it to string. then take the first two element.

    In java you can do this by following code. Let the variable is an integer named x . then you can use

    byte[] array= Integer.toString(x).get.bytes(). 
    

    Now array[0] and array[1] is the first two digits. array[array.length-1] and array[array.length] are the last two.

提交回复
热议问题