YYYY-mm-dd Form validation in Codeigniter - codeigniter

How to Done Date form Validation in Codeigniter,
I tried Like this,
$this->form_validation->set_rules('pastdate_start', 'Date of birth',
'regex_match[(0[1-9]|1[0-9]|2[0-9]|3(0|1))-(0[1-9]|1[0-2])-\d{4}]');
But I got
function Preg-match No ending matching delimiter ')' found
these error,how to solve it,please give me solution.
What mistake in my coding?

Try this..
$this->form_validation->set_rules('pastdate_start','Date of birth','required|regex_match[/^(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.]((?:19|20)\d\d),pastdate_start');

Related

AX 2012 Database - BaseEnum to String

I am trying to Code a "while select" Statement.
I have a table "CarBrandTable" with two fields:
CarBrandId and Countries.
CarBrandId is a String.
Countries is a Base Enum.
Now I want to get the Data, by asking with a select Statement.
When I want to retrieve the Data by saying info(carBrandTable.countries);
The Compiler says... "Argument 'txt' is incompatible with the required type"
I know that my baseenum is not a string and that I hvae to somehow convert it.
But I have Trouble in doing so.
Does anybody have a tip for me ?
Thanks in advance
Rephrase the info like this:
info(strFmt('%1', carBrandTable.countries));
Other way is enum2str function.
info(enum2str(carBrandTable.countries));

Possible to have a simple formula within the [value_if] argument? - excel

I'm trying to use a relatively basic IF function but having no luck - i'm sure i just have brackets or parenthesis wrong or something. Reckon it will be childsplay for you guys....
The formula is intended to show how many days a date has passed by. Date is shown in T column.
Basically it was working fine as the following, both for pending and past dates:
=IF(T7<=TODAY(), (TODAY()-T7),-(T7-TODAY()))
But I got greedy and wanted it to return more of a statement when the date has passed, as to how much it has passed by. So I've tried to make this happen with:
=IF(T7<=TODAY(),"EffOut(TODAY()-T7) days ago",-(T7-TODAY()))
Hoping it would enter "EffOut 8 days ago" (when TODAY()-T7 is 8 days) for example.
But it doesnt - it shows the entire argument i.e "EffOut(TODAY()-T7) days ago" in the return cell.
Is it possible to have a kind of embedded formula in the 'value_if' fields, mixed with text in this sense?
Happy to share the document if that would help, but will need to clear the data first so just let me know.
Thanks in advance, any help is much appreciated! Having read other posts I think it will just be a simple fix but its well beyond me! (I only got this far by perusing forums...)
Maybe something like this...
=IF(T7<=TODAY(),"EffOut "&DAYS(TODAY(),T7)&" days ago",-(T7-TODAY()))
=IF(T7<=TODAY(),"EffOut "&(TODAY()-T7)&" days ago",-(T7-TODAY()))
You just need to be careful to put "" around any strings. This is how Excel knows that's not a part of the formula. Remember to out the spaces is to the string like I did above so it looks like a sentence. The & sign combines the results of the calculated parts and the strings.

Timeago not working in ajax call

I an using this plugin for calculate timeago, it is not working when i load content by ajax call.
I have created 2 fiddle for this,Please check working fiddle
and not working fiddle
Can anyone tell me what is wrong with second one?
your html param in your post data is a mess:
html: "<abbr title="2013-06-21T12:57:04+0530" class="timeago">
2013-06-21 12:57:04
</abbr>"."<abbr title="2013-06-22T11:17:26+0530" class="timeago">
2013-06-22 11:17:26
</abbr>",
should be:
html: "<abbr title=\"2013-06-21T12:57:04+0530\" class=\"timeago\">2013-06-21 12:57:04</abbr>"+"<abbr title=\"2013-06-22T11:17:26+0530\" class=\"timeago\">2013-06-22 11:17:26</abbr>"
You are using quotes to encase your html string, but not escaping the quotes used in the html itself - and it appears you were trying to use a . to concat the string, in javascript you should use a +.
Though, the formatting is weird after that fix, it works.

How to check date in freemarker?

I have date variable in freemarker. i want to check that date is today or yesterday. If that date is today then need to display Today otherwise display Yesterday. Please can any one help me?
If you are sure that these are only possibilities (today and yesterday), then you could define a function like:
<#function isToday(aDate)>
<#return .now?date?iso_local == aDate?date?iso_local>
</#function>
and then you can use it for example as
${isToday(theDate)?string("today", "yesterday")}
Note that you will need FreeMarker 2.3.17 or later for that function to work. Also be careful with the Server time-zone, as that's what it uses in this example (unless you set that in the FreeMarker configuration manually... or with #setting in the templates).
${houradd(date, 1)?string("yyyy-MM-dd HH:mm:ss")}
${houradd(date, -1)?string("yyyy-MM-dd HH:mm:ss")}

Jquery Validation test for a value

I want to use jquery validation to validate an user input. He has to insert his Steam Id (a thing of a online game) in a form and I want to validate it but I have no ideia how to do that.
The Steam id expression has to like this: STEAM_0:1:2131341411
The thing that is required is this: STEAM_0:
Then it is just numbers
STEAM:0:(number 1 or 0):(numbers)
Maximum of characters of 20.
I've tried to do a regex thing to put in the add.method function but I couldnt,
Thank you, I hope you've understood what I meant
Try this regular expression: /^STEAM_0:(0|1):[1-9]{1}[0-9]{0,19}$/

Resources