close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Changing the Date Format in PhpMyAdmin DB

Thread began 5/22/2012 3:26 am by salaroche | Last modified 8/16/2013 12:46 pm by salaroche | 15884 views | 16 replies

Jason ByrnesWebAssist

This is of those simple questions to ask, but the answer is a bit long winded. so here goes:

data conversion and display relies on the following 2 php functions:
date()
strtotime()

The strtotime() function uses the separator to determine if the date being passed is a US formated date(m/d/Y) or European format (d-m-Y)

if the seprotor used is a slash:
2/12/2013

the strtotime function reads the date as:
Feb 12 2013

if you pas the same date to the strtotime function using a dash or period as the seperator:
2.12.2013
2-12-2013

the strtotime function will read that as the European format:
December 2 2013

so what this all boils down to is this:

if you pass the date as:
mm-dd-yyyy

using the dash as a separator to the strtotime() function, it gets treated as the European format:
dd-mm-yyyy

in order to use the dash separator with the us format and have the strtotime() functin treat it correctly, you will need to use extra copde to convert the - to a slash:

php:
<?php

if($_SERVER["REQUEST_METHOD"] == "POST")     {
  
$_POST['dateElement'] = "".((isset($_POST["dateElement"]))?date("Y-m-d"strtotime(str_replace("-""/"$_POST["dateElement"]))):"")  ."";
}
?>

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...