public function imageupload(Request $request) { $file = $request->file('file'); $d1 = new Date(); $t1 = $d1->getTimestamp(); $name = $t1 . ".jpg"; $request->file('file')->move(public_path() . getenv('IMAGE_PATH'), $name); return response()->json(array('success' => true, 'html' => 'ok', 'url' => getenv('IMAGE_PATH') . $name)); }
<?php require 'vendor/autoload.php'; use Jenssegers\Date\Date; // Set the language setlocale(LC_ALL, $argv[1] ?: 'en'); $months = array('january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'); $days = array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'); $translations = array(); foreach ($months as $month) { $date = new Date($month); $translation = strftime('%B', $date->getTimestamp()); $translations[$month] = $translation; echo "'" . $month . "'\t=> '" . $translation . "',\n"; } echo "\n"; foreach ($days as $day) { $date = new Date($day); $translation = strftime('%A', $date->getTimestamp()); $translations[$day] = $translation; echo "'" . $day . "'\t=> '" . $translation . "',\n"; }
/** * @return int|null */ public function getDeletedAtTimestamp() { return $this->deletedAt instanceof Date ? $this->deletedAt->getTimestamp() : null; }
public function testConstructTimestamp() { $date = new Date(1367186296); $this->assertSame(1367186296, $date->getTimestamp()); }