Here are the built-in localize formats:
{{ today | date:'medium' }} <!-- Aug 09, 2013 12:09:02 PM -->
{{ today | date:'short' }} <!-- 8/9/13 12:09 PM -->
{{ today | date:'fullDate' }} <!-- Thursday, August 09, 2013 -->
{{ today | date:'longDate' }} <!-- August 09, 2013 -->
{{ today | date:'mediumDate' }} <!-- Aug 09, 2013 -->
{{ today | date:'shortDate' }} <!-- 8/9/13 -->
{{ today | date:'mediumTime' }} <!-- 12:09:02 PM -->
{{ today | date:'shortTime' }} <!-- 12:09 PM -->
The date formatter also enables us to customize your date format to our own liking. We can combine
and chain together these format options to create one single date format, as well:
Year Formatting
Four-digit year: {{ today | date:'yyyy' }} <!-- 2013 -->
Two-digit padded year: {{ today | date:'yy' }} <!-- 13 -->
One-digit year: {{ today | date:'y' }} <!-- 2013 -->
Month Formatting
Month in year: {{ today | date:'MMMM' }} <!-- August -->
Short month in year: {{ today | date:'MMM' }} <!-- Aug -->
Padded month in year: {{ today | date:'MM' }} <!-- 08 -->
Month in year: {{ today | date:'M' }} <!-- 8 -->
Day Formatting
Padded day in month: {{ today | date:'dd' }} <!-- 09 -->
Day in month: {{ today | date:'d' }} <!-- 9 -->
Day in week: {{ today | date:'EEEE' }} <!-- Thursday -->
Short day in week: {{ today | date:'EEE' }} <!-- Thu -->
Hour Formatting
Padded hour in day: {{ today | date:'HH' }} <!-- 00 -->
Hour in day: {{ today | date:'H' }} <!-- 0 -->
Padded hour in am/pm: {{ today | date:'hh' }} <!-- 12 -->
Hour in am/pm: {{ today | date:'h' }} <!-- 12 -->
Minute Formatting
Padded minute in hour: {{ today | date:'mm' }} <!-- 09 -->
Minute in hour: {{ today | date:'m' }} <!-- 9 -->
Second Formatting
Padded second in minute: {{ today | date:'ss' }} <!-- 02 -->
Second in minute: {{ today | date:'s' }} <!-- 2 -->
Padded millisecond in second: {{ today | date:'.sss' }} <!-- .995 -->
String Formatting
am/pm character: {{ today | date:'a' }} <!-- AM -->
4-digit representation of time zone offset: {{ today | date:'Z' }} <!-- -0700 -->
Some examples of custom date formatting:
{{ today | date:'MMM d, y' }} <!-- Aug 09, 2013 -->
{{ today | date:'EEEE, d, M' }} <!-- Thursday, 9, 8 -->
{{ today | date:'hh:mm:ss.sss' }} <!-- 12:09:02.995 -->
这是我的psql查询,但它没有返回任何值。所以我只是控制查询以了解执行情况。
查询正在执行:
var searchValue = 'shahid';
var query = ("select * from students where name ilike '%"+searchValue+"%'");
当我将搜索值的第一个字母(Shahid)大写时,它正在执行完美。
答案 0 :(得分:1)
如果要传递大写,则应转换变量searchValue 例如。
var newSearchValue = (select initcatp(searchValue)) ;
这会将'shahid'转换为'Shahid'然后在查询变量中使用它。
答案 1 :(得分:0)
左侧缺少'%',只会匹配开头的内容 hahid
select * from students where name ilike 'hahid%'
与此
不一样select * from students where name ilike 'Shahid%'
仅匹配以 Shahid
开头的内容。现在,如果您想要与hahid
匹配的内容,那么您需要
select * from students where name ilike '%hahid%'
顺便说一下,如果searchValue来自I / O(用户,文件,网络等),那么你的例子是非常不安全的。