i'm using date module and create a date field using CCK
then i write some codes in php file to read it from the datebase
i found it's a string like"2008-05-14T19:30:00 "
how can i convert it to "2008-05014 19:30:00",for example?

i tried date_format or date_show_value...they didn't work.

thank u very much

Comments

HorsePunchKid’s picture

Category: support » bug
Priority: Normal » Critical

I'm having the same issue. It just came up after updating to the 5.x-2.x-dev version from 2008-04-30. Not sure yet why this happened, but it appears to be very problematic.

HorsePunchKid’s picture

Back up your tables first. This helped me:

update {your_cck_table} set field_{your_field} = replace(field_{your_field}, ' ', 'T'), field_{your_field}2 = replace(field_{your_field}2, ' ', 'T')

karens’s picture

Category: bug » support
Priority: Critical » Normal
Status: Active » Fixed

This is not a bug report and certainly not critical.

Assuming you're getting the value from the database where it is stored as a UTC value, and you want to display it in the site's timezone, do something like:

$date = date_make_date("2008-05-14T19:30:00 ", "UTC", DATE_ISO);
date_timezone_set($date, date_default_timezone());
date_format($date, 'Y-m-d H:i:s');
HorsePunchKid’s picture

It's a bug in the sense that something was working and then was no longer working after an update (which exactly I'm no longer sure). It seemed that at some point something went from expecting a space in the date string to expecting a T in the date string. It is certainly critical in the sense that no data was being displayed anymore. Perhaps I should have adjusted the title to clarify.

After updating to the latest dev version, my events have all disappeared from the calendar again, but the cause must be different this time.

karens’s picture

The issue is a question about how to convert an ISO date in the database to the datetime version. How is that a bug? What are you talking about that is no longer working? I'm completely confused by this issue.

karens’s picture

If you're not seeing dates after your update, that's a completely different issue that could have a number of causes, so open a different issue and explain that more completely -- what kind of dates did you create? Where are they not showing up? In the node? In a View? If so, in what View?

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.