Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit bd7e17e

Browse files
committed
3280
1 parent 7581bd5 commit bd7e17e

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
class Solution
3+
{
4+
/**
5+
* @param String $date
6+
* @return String
7+
*/
8+
public function convertDateToBinary($date)
9+
{
10+
[$year, $month, $day] = explode('-', $date);
11+
12+
$yearBinary = decbin((int) $year);
13+
$monthBinary = decbin((int) $month);
14+
$dayBinary = decbin((int) $day);
15+
16+
return $yearBinary . '-' . $monthBinary . '-' . $dayBinary;
17+
}
18+
}
19+
20+
$solution = new Solution();
21+
22+
$date = '2023年10月05日';
23+
24+
$result = $solution->convertDateToBinary($date);
25+
26+
print_r($result);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /