Solved

Regular expression for mm/dd/yyyy

Posted on 2004-08-25
1
1,595 Views
Last Modified: 2006-11-17
What regular expression will get month, day year from mm/dd/yyyy?
0
Comment
Question by:RichardFox
1 Comment
 
LVL 9

Accepted Solution

by:
AlanJDM earned 125 total points
ID: 11894045
Why use a regex? Use the date() function...

$date = '08/25/2004';
$month = date('M',strtotime($date));
$day = date('d',strtotime($date));
$year = date('Y',strtotime($date));


Alan
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now