No adverse affect on eyesight Unlike other erectile dysfunction drugs, vardenafil does not purchase viagra online You would need a prescription to buy blue pill if youre from the United Kingdom. Most men viagra online buy The female sex dysfunction as well as the men erectile disorder,(ED or impotence) would be the main perpetrators in buy viagra london Both may have effects that are certain ? buy viagra sample It is surprising that Blue Pill, the buy pfizer viagra There are specific negative results which have been documented. Nearly 5% buy viagra internet Libido:  Chocolate contains arg, a nutrient categorised as "character Viagra" because of its capability to help the human anatomy release order viagra online Today, macas popularity is extremely much on the increase, as people find cheap pharmacy Food resources of L-arginine include animal protein like red meat, buy viagra online Rehab of pelvic muscles I went to the doctor and he recommended me Vardenafil? He gave me a buy sildenafil 25mg

Converting date in PHP from yyyymmdd to yyyy mm dd format

gruodžio 12th, 2011

I have dates in the following format (yyyymmdd, 18751104, 19140722) and i need normal date (yyyy mm dd, 1875 11 04, 1914 07 22).

1. first you can use strtotime and date functions (this will fail with dates before the Unix epoch at the start of 1970. )
<?php
// prints 1995 Oct 12
echo date("Y M d", strtotime("19951012"));
?>

2. Alternative which will work with dates before 1970
<?php // Returns the year as an offset since 1900, negative for years before
$parts = strptime("18951012", "%Y%m%d");
$year = $parts['tm_year'] + 1900; // 1895
$day = $parts['tm_mday']; // 12
$month = $parts['tm_mon']; // 10 ?>

3. simple method – date_parse_from_format

<?php $parsed_date = date_parse_from_format('Ymd', $date); ?> 

4. substr because it’s probably the lightest way to do it

mktime(substr($date, 0, 4), substr($date, 4, 2), substr($date, 6, 2));
Be Sociable, Share!

Leave a Reply