Skip to content

Instantly share code, notes, and snippets.

@sota1235
Created October 8, 2016 10:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sota1235/3a3cd46451a4f88e7a19dc426e6bbf3b to your computer and use it in GitHub Desktop.
Save sota1235/3a3cd46451a4f88e7a19dc426e6bbf3b to your computer and use it in GitHub Desktop.
<?php
// validation for date format according with ISO8061
$date = '2016-09-30T12:00:00+900';
preg_match(
'/^\d{1,4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])T([0-1][0-9]|2[0-4]):[0-5][0-9]:[0-5][0-9](Z|(\+|-)([01][0-9]|2[0-4]):?([0-5][0-9])?)$/'
$date
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment