View Issue Details

IDProjectCategoryView StatusLast Update
07811User patchesSurvey at runtimepublic2014-01-11 09:04
ReportermfaberAssigned Tomfaber 
PrioritynormalSeveritytweak 
Status closedResolutionfixed 
Product Version 
Target VersionFixed in Version2.00 
Summary07811: Expression manager: implement PHP-function strtotime
Description

Calculating with dates/times in LS would be MUCH easier if the PHP function strtotime would be available for use in expression manager.

I propose to add this one by adding the following line in em_core_helper.php:

'strtotime' => array('strtotime', 'LEMstrtotime', $this->gT('Convert a date/time string to unix timestamp'), 'int strtotime(string)', 'http://www.php.net/manual/de/function.strtotime.php', 1),

Additional Information

in beta 3 and in recent 2.00+ build it'd be line 224 of em_core_helper.php.

Thanks a lot!

TagsNo tags attached.
Complete LimeSurvey version number (& build)130423

Relationships

parent of 07953 closedmfaber Bug reports strototime removed from EM 

Activities

DenisChenu

DenisChenu

2013-05-06 21:43

developer   ~25184

Can be done, but need phpJS strtotime too http://phpjs.org/functions/strtotime/.

But : not sure it's really a solution, because date question are not in english.

Need a real LSDate2time function

mfaber

mfaber

2013-05-06 21:43

reporter  

em_core_helper.diff (205 bytes)
223a224
> 'strtotime' => array('strtotime', 'LEMstrtotime', $this->gT('Convert a date/time string to unix timestamp'), 'int strtotime(string)', 'http://www.php.net/manual/de/function.strtotime.php', 1),
em_core_helper.diff (205 bytes)
mfaber

mfaber

2013-05-06 21:54

reporter   ~25186

Thanks for the quick feedback, Denis!

Yes it's true that names of months have to be english but it works not only with english date formats. It can work with many different date formats.
(such as: 30.01.2008, 2008/01/30, 2008-6-30, 30-June 2008)
See: http://www.php.net/manual/de/datetime.formats.date.php

The function would make life easier because using {mktime(0,0,0,substr(date1,3,2),substr(date1,0,2),substr(date1,6,4))}
is really painful!

Thanks for considering!

mfaber

mfaber

2013-05-13 16:18

reporter   ~25235

please.... ;)

mfaber

mfaber

2013-06-18 11:44

reporter   ~25581

Last edited: 2013-06-18 11:46

View 2 revisions

close me! ;)

Implemented in 2.00+ (master). with merged pull request https://github.com/LimeSurvey/LimeSurvey/pull/85.

DenisChenu

DenisChenu

2013-06-22 09:44

developer   ~25611

mfaber : best is tu use #XXX in your github commit comment : then comit are "attached" to issue.

If nit : use http://bugs.limesurvey.org/plugin.php?page=Source/list&id=2 to attach it manually :)

DenisChenu

DenisChenu

2013-06-22 09:45

developer   ~25612

Think you can change the status ?
No

mfaber

mfaber

2013-06-22 12:27

reporter   ~25619

DenisChenu: Thanks for the hint. Will do in my next pull request.
I think I cannot change the status (do not have the rights as a "reporter").

Should I make the changes also for 2.05 and do another pull request?
Thanks again!

Related Changesets

LimeSurvey: master 3319e3b7

2013-06-14 08:06:10

c_schmitz

Details Diff
Merge pull request #85 from mfaber/strtotime

New feature: Add php-func strtotime() to EM
Affected Issues
07811
mod - application/helpers/expressions/em_core_helper.php Diff File
mod - scripts/expressions/em_javascript.js Diff File

LimeSurvey: 2.05 09b6af55

2013-06-26 11:54:53

sammousa

Details Diff
Merge pull request #94 from mfaber/strtotime_205

new feature 07811: implement strtotime() for EM
Affected Issues
07811
mod - application/helpers/expressions/em_core_helper.php Diff File
mod - scripts/expressions/em_javascript.js Diff File

Issue History

Date Modified Username Field Change
2013-05-06 21:13 mfaber New Issue
2013-05-06 21:43 DenisChenu Note Added: 25184
2013-05-06 21:43 mfaber File Added: em_core_helper.diff
2013-05-06 21:54 mfaber Note Added: 25186
2013-05-13 16:18 mfaber Note Added: 25235
2013-06-18 11:44 mfaber Note Added: 25581
2013-06-18 11:46 mfaber Note Edited: 25581 View Revisions
2013-06-22 09:44 DenisChenu Changeset attached => LimeSurvey master 3319e3b7
2013-06-22 09:44 DenisChenu Note Added: 25611
2013-06-22 09:45 DenisChenu Note Added: 25612
2013-06-22 12:27 mfaber Note Added: 25619
2013-06-26 19:59 DenisChenu Assigned To => mfaber
2013-06-26 19:59 DenisChenu Status new => assigned
2013-06-26 19:59 DenisChenu Relationship added parent of 07953
2013-06-26 20:00 DenisChenu Status assigned => resolved
2013-06-26 20:00 DenisChenu Fixed in Version => 2.00
2013-06-26 20:00 DenisChenu Resolution open => fixed
2013-06-27 13:38 mfaber Changeset attached => LimeSurvey 2.05 09b6af55
2014-01-11 09:04 mfaber Status resolved => closed