Jump to content

date field


hmark

Recommended Posts

Well, I'm not sure about what you're looking for, but here's

a small example about how to format the current date like that.

 

<?php

$year = date("Y");
$month = date("m");

$year_formated = $year[2] . $year[3];

if($month == "01"){$month_formated = "Jan";}
if($month == "02"){$month_formated = "Feb";}
if($month == "03"){$month_formated = "Mar";}
if($month == "04"){$month_formated = "Apr";}
if($month == "05"){$month_formated = "May";}
if($month == "06"){$month_formated = "Jun";}
if($month == "07"){$month_formated = "Jul";}
if($month == "08"){$month_formated = "Aug";}
if($month == "09"){$month_formated = "Sep";}
if($month == "10"){$month_formated = "Oct";}
if($month == "11"){$month_formated = "Nov";}
if($month == "12"){$month_formated = "Dec";}

$date_formated = $month_formated . "-" . $year_formated;

echo $date_formated;

// THERE YOU GO, YOU HAVE THE DATE FORMATED LIKE THAT IN THE date_formated VARIABLE

?>

 

I hope it helps you out somehow.

If you need more help, just send me a message.

Link to comment
https://forums.phpfreaks.com/topic/188391-date-field/#findComment-995071
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.