Gossamer Forum
Quote Reply
Setting a Datetime field
Hi-

I can use the following to set the date for a DATE formatted field:

$set->{User_Mod_Date} = GT::Date::date_get();

Does anyone know if there is a way to get the information for a DATETIME formatted field?

If I use the above, it always makes the date something like:

2004-11-15 00:00:00

It leaves out the time. But I need it to put in the time variables as well. Something like:

2004-11-15 13:21:59

Does anyone know if there is a GT function similar to GT::Date::date_get(); to accomplish this?

--Frank
Quote Reply
Re: [FrankM] Setting a Datetime field In reply to
Hi,

You have the right function. By default date_get will get the date in the format that is currently set. If you want it to get the date in a different format you either need to change the format before getting the date (and remember to change it back again afterwards or you'll find big problems) or tell date_get the format that you want. I think that something like this should work:
$set->{User_Mod_Date} = GT::Date::date_get(time,'%yyyy%-%mm%-%dd% %HH%:%MM%:%ss%');
Quote Reply
Re: [afinlr] Setting a Datetime field In reply to
Thanks! Your solution worked perfectly. Smile

--Frank