Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8390847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:06:43+00:00 2026-06-09T19:06:43+00:00

i was fetching this date from table in the database like this format Sunday

  • 0

i was fetching this date from table in the database like this format

Sunday 16th of January 2011 06:55:41 PM

and i want to convert it to be like this format

11-05-2012

how to do that with date function or any function

when i use date function

 <td><?php echo date('d-m-Y', $v['v_created']); ?></td>

i get error message

 'Severity: Warning

Message: date() expects parameter 2 to be long, string given'
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T19:06:43+00:00Added an answer on June 9, 2026 at 7:06 pm

    This works for me (just tested on local web server)

    <?php
    
    date_default_timezone_set ('Europe/Rome');
    
    $date = "Sunday 16th of January 2011 06:55:41 PM";
    
    //.Strip "of" messing with php strtotime
    $date = str_replace('of', '', $date);
    
    $sql_friendly_date = date('y-m-d H:i', strtotime($date));
    
    echo $sql_friendly_date;
    
    ?>
    

    You can format the date as you prefer changing the first parameter of Date function according to: https://www.php.net/manual/en/function.date.php

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Oracle Date column in a db table, and fetching this field
I want convert string value into date in my project because I am fetching
I am new to extjs and want to change date format. I am fetching
This is my php script for fetching data from a db. <?php mysql_connect(host,user,pass); mysql_select_db(db);
I'm fetching some data from an MSSQL table using the mssql_fetch_object, but the text
So I have this function that takes all the users from an MySql table
Hello I have a problem with fetching required rows from MySQL table correctly within
NSString *strSql = @select tblrecentsearch_id,xmlrequest,company,postcode,city,kilometer,date from tblrecentsearch; returnValue = sqlite3_prepare_v2(database, [strSql UTF8String], -1, &selectStatement,
I want to compare between two dates. From both the dates, I am fetching
I am trying to retrieve results from this query, but it is not fetching

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.