Link to home
Start Free TrialLog in
Avatar of Robert Granlund
Robert GranlundFlag for United States of America

asked on

Variable into datetime Format

How do I write this in PHP:

$date = "date_format(date_time'%a %c/%e')";

Open in new window

Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

There is something missing in your question like where are you getting this?  PHP has a 'date_format' function but not a "date_time'%a %c/%e'" function.

Also, I recommend that you do not use PHP reserved words like 'date' as variable names.  Can cause problems.
Avatar of Robert Granlund

ASKER

How do you "date_format" a variable that is a date?
The PHP date() function can format for just about any valid date.  However, what you posted above is not coming from PHP.  Where are you getting it?  What format is it in?  This is clearly not just a PHP question because PHP doesn't have all those functions.  And 'date' formats are not universal, many programs format them differently.
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you for that.  It made something I'm doing much easier
Thanks for the points.  Hope the article is helpful to you! ~Ray