Time format conversion + fixed fields plus spaces

Source: Internet
Author: User

1. If the string is 20140202, make the DateTimePicker value equal to this:

Assign value
int sj = Int. Parse (CLSJ. Substring (0, 8));
int year = sj/10000;
Int month = (sj% 10000)/100;
int day = (sj% 10000)% 100;
Dtp_rdrq. Value = new DateTime (year, month, day);//was filed date DTP_RDRQ is DateTimePicker


The value of 2.datetimepicker is converted to 20140202

Dtp_rdrq. Value.tostring ("YYYYMMDD")

3.textbox Content Fill Space

Txt_yddxdm. Text.trim (). PadRight (3, ") fixed 3 lengths, if not enough, fill the blanks on the right

Txt_yddxdm. Text.trim (). PadLeft (3, ") fixed 3 lengths, if not enough, fill the left blank

Time format conversion + fixed fields plus spaces

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.