Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Pondelok, 30. november 2026
O nás
Magazín
Otvorený softvér
CVS
Služby
Index  »  Projekty  »  phpMyEdit  »  Fórum  »  phpMyEdit-mce-cal timestamp

phpMyEdit Configuration     phpMyEdit-mce-cal timestamp
Odoslať novú tému   Odpovedať na tému    
 
zoycite     Založený: 03.12.2006   Príspevky: 3  
Príspevok Zaslal: 2006-12-03 09:46
Návrat hore  Odpovedať s citátom     

The calendar works, however I am unable to have the calendar start up based on a unix timestamp.

I have been reading the jscalendar documentation and the phpMyEdit documentation and searching the forums to see if this is even possible without heavy modifications to jscalendar. I found nothing in the calendar docs about this. I found a wealth of topics on the the calendar but it seems I was unable to locate anything useful. I also checked the php documentation for strftime options to accomplish this and no go.

If there does exist a topic or reference for this I would appreciate a link to it, or any help you can provide is much appreciated.

 
ajh     Založený: 17.12.2003   Príspevky: 236  
Príspevok Zaslal: 2006-12-03 19:42
Návrat hore  Odpovedať s citátom     

Easiest way of doing this is to use the MySQL date conversion functions to do this. I assume that you database columns stores date/time in Unix format. So you need to put an SQL and SQLW option on the field in PME to convert to/from Unix dates as follows:

Kód:
...['sql'] = 'FROM_UNIXTIME(colname)';
...['sqlw'] = 'UNIXTIME($val)';


 
zoycite     Založený: 03.12.2006   Príspevky: 3  
Príspevok Zaslal: 2006-12-10 03:26
Návrat hore  Odpovedať s citátom     

well i use the %s option, on the strftime mask and it seems to write and read the right values, except when the calendar is initilized, the calendar is initilized with the current date instead of the timestamp.

 
ajh     Založený: 17.12.2003   Príspevky: 236  
Príspevok Zaslal: 2006-12-10 15:56
Návrat hore  Odpovedať s citátom     

Could you post the definition of the MySQL column concerned, the PME definition of that column from your PME setup file and your setup for jscalendar?

Could you also tell me what versions of PME and jscalendar you are using please?

By default, jscalendar should pick up your strftime set up to use as the input format.

Thanks

Adam

 
zoycite     Založený: 03.12.2006   Príspevky: 3  
Príspevok Zaslal: 2006-12-10 23:05
Návrat hore  Odpovedať s citátom     

Expiration in MySQL is of type int(11)

Kód:
//PME
$opts['fdd']['Expiration'] = array(
  'name'     => 'Expiration',
  'select'   => 'T',
  'maxlen'   => 11,
  'options'  => 'AVPDC',
  'datemask' => 'D M j, Y g:i A',
  'strftime' => '%s',
  'default'  => '0',
  'sort'     => true,
  'calendar' => true
);


According to the generated code for PME i am using
* phpMyEdit version: unknown
* phpMyEdit.class.php core class: 1.188
* phpMyEditSetup.php script: 1.48
* generating setup script: 1.48

For js calendar i just downloded it recently the version is 1.0.

I was reading that it should pick up on the strftime mask and use it as the input in the jscalendar documentation, however when it did not, im not sure if this is a PME issue or a calendar, or maybe im just not doing something right.

 
aeiche     Založený: 06.04.2007   Príspevky: 10  
Príspevok Zaslal: 2007-05-08 19:00
Návrat hore  Odpovedať s citátom     

I wanted to add a couple of things onto this topic because I've been struggling with this problem a bit this morning. So for new people like me:

Kód:

  'sql'  => 'FROM_UNIXTIME(last_edit_date)',
  'sqlw' => 'UNIX_TIMESTAMP("$val")',

note the quotes on the sqlw. They are necessary, otherwise mySQL won't interpret the value properly.

also, make sure that the length of your field is long enough to hold the value. if you're using a timestamp, you're likely doing an INT type with an 11 character length. that's not long enough for a date-timestamp, so increase your maxlength.

 
Odoslať novú tému   Odpovedať na tému    

Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok · Odkazový formulár · Prihláška
Upozorniť na chybu na PLATON.SK webstránke · Podmienky použitia · Ochrana osobných údajov