如何用datetimepicker值写一个长日期

时间:2016-07-22 12:56:47

标签: c# datetimepicker

如何让datatimepicker组件可以写长日期?

在我的情况下,我想在标签上显示单词的数量。

label1.text = DTPicker1.value.ToString();

示例:

输入:2016年7月13日:2016年7月13日

我的dataPicker属性:

CustomFormat : dd MMMM yyyy 
Format : Custom

但即使有这个设置,价值仍然是13/07/2016 09:50 AM

2 个答案:

答案 0 :(得分:6)

您是否尝试将格式作为{ "name": "laravel/laravel", "description": "The Laravel Framework.", "keywords": ["framework", "laravel"], "license": "MIT", "type": "project", "require": { "php": ">=5.5.9", "laravel/framework": "5.2.*" }, "require-dev": { "fzaninotto/faker": "~1.4", "mockery/mockery": "0.9.*", "phpunit/phpunit": "~4.0", "symfony/css-selector": "2.8.*|3.0.*", "symfony/dom-crawler": "2.8.*|3.0.*", "laravel/framework": "5.2.*", "illuminate/html": "~5.0" }, "autoload": { "classmap": [ "database" ], "psr-4": { "App\\": "app/" } }, "autoload-dev": { "classmap": [ "tests/TestCase.php" ] }, "scripts": { "post-root-package-install": [ "php -r \"copy('.env.example', '.env');\"" ], "post-create-project-cmd": [ "php artisan key:generate" ], "post-install-cmd": [ "Illuminate\\Foundation\\ComposerScripts::postInstall", "php artisan optimize" ], "post-update-cmd": [ "Illuminate\\Foundation\\ComposerScripts::postUpdate", "php artisan optimize" ] }, "config": { "preferred-install": "dist" } } 调用的参数传递?

如下所示:

ToString()

答案 1 :(得分:0)

只需将日期格式添加到.ToString()来电:

label1.text = DTPicker1.value.ToString("dd MMMM yyyy");

可在MSDN

上找到更多信息