473,398 Members | 2,113 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

How to fix date conversion error

25
I have a date format: $date = "Sun May 09 20:07:50 +0000 2010";
I have to convert it into 09-05-2010 this format. I am getting it when i echo like this;

echo date("d-m-Y", strtotime($date));

But problem is when i try to echo it in loop it gives me answer as 31-12-1969

I am using loop as
Expand|Select|Wrap|Line Numbers
  1.     foreach($users as $k=>$v)
  2.                 {
  3.                      if($k == 'test')
  4.                      {
  5.                          foreach ($v as $k1=>$v1)
  6.                          {
  7.                                echo $date1 = date("d-m-Y", strtotime($date));
  8.                          }
  9.                     }
  10.                 } 
  11.  
May 29 '10 #1
4 1674
zorgi
431 Expert 256MB
variable $date is not defined
May 29 '10 #2
Markus
6,050 Expert 4TB
Works fine for me, bandy. I assume the issue is elsewhere in your code.
May 29 '10 #3
bandy
25
@Markus
Hi,
Yes Markus, I was not getting input properly, now problem is solved.

Thanks.
May 29 '10 #4
Markus
6,050 Expert 4TB
Okay then, bandy. See you around.
May 29 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Marauderz | last post by:
Hello guys, got a little question regarding the regional language settings . Anyway I got a Windows 2003 Server machine that was installed with the date format "dd/MM/yyyy" and location still...
12
by: Rob T | last post by:
I'm storing a date/time into a SQL table of type datetime. I need it to be precise so the value is stored to the 1000th of a second. ie "insert into myTable mydate values ('08/05/2005...
4
by: Wayne Wengert | last post by:
I am using VB.NET - VSNET 2003 and accessing data from an SQL Server. I am trying to convert a datetime field retrieved from the DB to a format like "MM/DD/YYYY" - I want results like "10/28/2004"....
2
by: Lars Erik Nes | last post by:
Hi all. I have a problem. I get all my data from a dataset (not mssql) and in that dataset i have a table called "Activity". In this table i have a few date fields. When i display the dataset...
2
by: psycho | last post by:
in sqlserver in date is stored in a particular format. Date and time are stored in same column. so if i want to display only date or only time in the datagrid is there any solution?
5
by: krishnakant Mane | last post by:
hello all. thanks for the help and for pointing me to the proper url for wxpython related issues. I am so happy that I now have a very easy gui library that can do practically every thing with...
0
by: RadhakrishnanR | last post by:
HI ALL, My .NET application devloped in C# used mainly class file (OOAD) and user controls etc and it is desktop application not web based application. Database is SQL server 2000. Now I have...
5
manoj9849967222
by: manoj9849967222 | last post by:
Hi All I have a problem with date format. I have designed a table with one of the field as Date. when i enter the date it is comming in mm/dd/yyyy format. Is there a way to change the format to...
7
by: creative1 | last post by:
Hello everyone. I am experiencing a strange problem that I can't fix on my own. I think I need expert's suggestions for this. The problem is: I want to print account statement (or any other...
3
by: Jozo | last post by:
Dear All, This is my first time on this site and I am very happy! I have problem regarding to date (new or old ms access document) My problem is that access changes date after 09/11 to 11/09 i...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.