473,386 Members | 1,793 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,386 software developers and data experts.

Date stored in DB in the following format: 2004-06-29 09:06:36+01

Hi,

I am trying to convert a date in the following format with the date
function (i.e. date("d/m/y", strtotime($dbdate));):

2004-06-29 09:06:36+01

The database was created by another programmer as I normally store my
dates as datetime type in the format:

2005-07-08 10:52:44

Any help? Cheers

Burnsy

Jul 17 '05 #1
1 1270
bi******@yahoo.co.uk wrote:
I am trying to convert a date in the following format with the date
function (i.e. date("d/m/y", strtotime($dbdate));):

2004-06-29 09:06:36+01

The database was created by another programmer as I normally store my
dates as datetime type in the format:

2005-07-08 10:52:44

Any help? Cheers


It will actually work as-is, although the +01 is a timezone offset so
may give you unexpected results depending on the time of day (which may
of course be the intention).

If you want to remove the +01 at the end then use substr() to get rid of
it eg date("d/m/y", strtotime(substr($dbdate, 0, 19))); Or you could do
it in the database query itself.

--
Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Niall Porter | last post by:
Hi all, I'm building an ASP app on a Windows 2000/IIS machine which interfaces with our SQL Server 2000 database via OLE DB. Since we're based in the UK I want the users to be able to type in...
3
by: Andrew Poulos | last post by:
I'm updating a db in which I have a column of Date/Time data type. The regional settings here for short date are: day / month / full year eg. 28/4/2005 It's easy enough for me to build a string...
2
by: Sasha | last post by:
Hi, What is an easy way to create DateTime from a string that contains date in the following format "yyyyMMdd"? Take care, Sasha
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...
1
by: Mindy | last post by:
I have a text string A as "3/9/2006 1:21:00 PM". I want to compare A wich Now(). Is there any function to transfer A to date and time format? Thanks. Mindy
12
by: blast | last post by:
hi , i have a problem, here is the issue.... i have table with date stored as int.....say for eg : date: 11/30/2006 time:09:15 am is stored in the table as 1164896114 now i need to compare...
2
by: shannonwhitty | last post by:
I am able to extract dates in the correct format i.e. SELECT CONVERT(VARCHAR(8), GETDATE(), 3) =dd/mm/yy My issue is that my users are selecting a date in this format and I need to select...
3
by: gsreenathreddy | last post by:
Hi! I would like to insert the date in specified format in DB, the date type is Date Type, I am using the following queries to insert the data 1) INSERT INTO EMP VALUES (1, 'red', 'CLERK', 2,...
4
by: phpmagesh | last post by:
Hi, I have to show system date in custom format For example: 2009/Oct/06 I want to show date in above format. how to get this output . i used the below format
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.