我有一个日期,它是一个看起来像这样的字符串:
Apr 25 2018 12:00AM
我想要做的是将此日期格式转换为 yyyy-MM-dd 然后将其转换回字符串,我尝试了以下操作:
let formatter = DateFormatter()
formatter.dateFormat = "M dd yyyy h:mm A"
let SLAIssuedFinalGradingDate = formatter.date(from: tableDic["SLAIssuedFinalGradingDate"] as! String)
formatter.dateFormat = "yyyy-MM-dd"
let SLAIssuedFinalGradingDateString = formatter.string(from: SLAIssuedFinalGradingDate!)
Run Code Online (Sandbox Code Playgroud)
但SLAIssuedFinalGradingDate总是返回零,我做错了什么?
我有一个带有完成处理程序的方法
func postLandGradingImages(cellHolder: Array<ImagesData>, completionHandler:@escaping (_ result:Bool) -> Void) {
//Define bool for returning data
var returnedResults = false
//Call API
WebService().postLandGradingImages(cellHolder)
{
(result: Bool) in
DispatchQueue.main.async {
//Return our results
returnedResults = result
completionHandler(returnedResults)
}
}
}
Run Code Online (Sandbox Code Playgroud)
我在这样的循环内调用此方法:
for asset: PHAsset in photoAssets
{
self.postLandGradingImages(cellHolder: [ImagesData(jobNo: self.JobNo, ImageBytes: imageStr)]) { result in
}
}
Run Code Online (Sandbox Code Playgroud)
我想做的是,如果此操作在某个时候失败,则显示警报并停止循环,并在循环完成后,所有返回true的呼叫最后都显示警报。
这是我尝试过的:
var returned = false
for asset: PHAsset in photoAssets
{
imageManager.requestImage(for: asset, targetSize: CGSize(width: asset.pixelWidth, height: asset.pixelHeight), contentMode: .aspectFill, options: options, resultHandler: { …Run Code Online (Sandbox Code Playgroud) 我在这里找到这个网站:
http://theme.pixflow.net/massive-dynamic/design-studio/#team-section
我想做的是让元素滚动移动,就像图像在我遇到的站点中一样。
我注意到他们使用的是转换而不是固定的。如何使用CSS和/或jQuery完成此操作?
我试图用 datepicker 做的是当它第一次显示时,显示当前日期加上 6 个月,你可以用 startDate 来做,但月份后退按钮被禁用。我试图为今天的日期设置一个 minDate,同样的交易,月份返回按钮被禁用。
是否可以将开始日期设为当前日期加 6 个月,但允许用户单击后退按钮并且不允许超过当前日期。
var date = new Date();
date.setDate(date.getDate() - 1);
var defaultDate = new Date();
defaultDate.setMonth(date.getMonth() + 6);
$('[data-toggle="datepicker"]').datepicker({
format: 'dd/MM/yyyy',
autoHide: true,
minDate: date,
startDate: defaultDate,
changeMonth: true
});
Run Code Online (Sandbox Code Playgroud) 我的 URL 看起来像这样example.com/test-page/now_here,但我希望 URL 看起来像这样example.com/test-page/now-here。
我在我的文件中尝试了以下操作.htaccess:
RewriteRule ^(/?test-page/.*/[^/]*?)_([^/]*?_[^/]*)$ $1-$2 [N]
RewriteRule ^(/?test-page/.*/[^/]*?)_([^/_]*)$ $1-$2 [R=301]
Run Code Online (Sandbox Code Playgroud)
但这没有用。当我转到时出现 404 错误/test-page/now-here
我究竟做错了什么?
这是我的完整内容.htaccess:
Options -Indexes
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_USER_AGENT} ^(.+)$
RewriteCond %{SERVER_NAME} ^example\.com$
RewriteRule .* https://www.%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
RewriteRule ^(/?test-page/.*/[^/]*?)_([^/]*?_[^/]*)$ $1-$2 [N]
RewriteRule ^(/?test-page/.*/[^/]*?)_([^/_]*)$ $1-$2 [R=301]
Header add Strict-Transport-Security "max-age=300"
</IfModule>
<IfModule mod_headers.c>
<If "%{REQUEST_SCHEME} == 'https' || %{HTTP:X-Forwarded-Proto} …Run Code Online (Sandbox Code Playgroud) 我有一个像这样编写的javascript数组...
var json = [
{"id":"1", "title":"Test 1", "comment":"This is the first test"},
{"id":"2", "title":"Test 2", "comment":"This is the second test"}
];
Run Code Online (Sandbox Code Playgroud)
我想要做的是得到每一个ID.
我一直在尝试这个
for(x in json[0]){
alert(x.id);
}
Run Code Online (Sandbox Code Playgroud)
但没有运气,有人能指出我正确的方向吗?谢谢,麻烦您了 :)
我有两列的表(startdate和enddate),我有两个提交日期(2012-02-29和2012-03-30)我试图获取startdate(2012-02-29)和enddate之间的数据( 2012-03-30)
我试过了
i.startdate between '2012-02-29' and i.enddate '2012-03-30'
Run Code Online (Sandbox Code Playgroud)
但这没有用,我一直在谷歌搜索这几个小时没有明确的答案,任何帮助将不胜感激,谢谢提前.
我有这些图像,我从我的服务器和使用PHP的数据库
<div class="pics">
<img src="upload/<?php echo $array['image'] ?>" height="200"/>
</div>
Run Code Online (Sandbox Code Playgroud)
实际尺寸很大,但我需要它们都在200的高度.
如何使用jQuery找到此图像的宽度,我无法在任何地方找到教程....
任何帮助,将不胜感激.
谢谢你的时间,J
我试图通过cron作业运行一个php文件,当我手动运行它时文件工作正常,但是当我在cron作业中运行它时,我收到此错误:
Warning: include(classes/EmailAddressValidator.php): failed to open stream: No such file or directory in /var/www/onecent_dev/classes/MiscFunctions.php on line 3
Warning: include(): Failed opening 'classes/EmailAddressValidator.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/onecent_dev/classes/MiscFunctions.php on line 3
Run Code Online (Sandbox Code Playgroud)
MiscFunctions.php和EmailAddressValidator.php都是现有文件并且位于正确的位置,是什么给出的?
谢谢
当我尝试上传3,424KB的文件并出现此错误时,出现此错误
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 12864 bytes)
Run Code Online (Sandbox Code Playgroud)
但是当我尝试上载4,891KB的文件时,为什么会这样呢?
另外,我已经更新了我的php5.ini文件,权限一切正常。
任何提示将非常棒!
Ĵ
这是发生错误的代码行:
$image = imagecreatefromjpeg($source);
Run Code Online (Sandbox Code Playgroud) php ×5
jquery ×3
ios ×2
javascript ×2
swift ×2
.htaccess ×1
apache ×1
arrays ×1
between ×1
cron ×1
crontab ×1
css ×1
date ×1
datepicker ×1
fatal-error ×1
file-upload ×1
for-loop ×1
mod-rewrite ×1
regex ×1
sql ×1
width ×1