I'm sure for the experienced java guys custom date and time is pretty easy. But for PHP users... this write up should save you a bunch of time.
Zimbra uses a custom date formatting class AjxDateFormat. It's similar to the well documented Java Simpledateformat class, but I can't get to that class very easy from within a zimlet. There are probably some other benefits from using the Zimbra custom AjxDateFormat class. If you want to see some of the options and usage for that class you con look at the file, as well as the source class. ( I have not posted where the source class is, short on time, but do a search through the source code and you can find it.)
/opt/zimbra/tomcat/webapps/zimbra/
js/AjaxNewWindow_all.
js
In the above mentioned file you can search for AjxDateFormat to see many of the options. There are some already built options like
.short, .medium, .long, .full as well as some to get the month name and such. I'm using the date meta options to create the date exactly as I want it. This is more what I'm used to doing in PHP and should be familiar to php users.
------
My java object is obj.date. This outputs as a string or int, not really sure what it is, but not a date object. We have to stuff obj.date into a new date object so we can format it.
Code:
//obj.date is the time of our email message from doDrop.
var formatter =new AjxDateFormat("yyyy-mm-dd HH:mm:ss");// example output 2007-01-09 17:30:20
var Xdate = formatter.format(new Date(obj.date)) ; Now I can pass Xdate to my custom form and it's formatted the way I like it.
----
If you want something that the user can read more easily. Create two inputs in your form
1. readonly using .long which should look something like Friday, Jan 9 1971 (this is from memory so don't quote me on it).
2. a hidden input field with the value = to the date you want to pass into your other database. Something like mike which looks like 2007-01-09 17:30:22.