Automatic conversion of date addition methods in the student information management system

Source: Internet
Author: User

In the student information system, we need to add the birth date and admission date when adding students to the student status. when the average person does not know the Add format, they will be written as 2013.8.7 or 2013/8/7, few people write the date format as 2013-8-7, and our database receives the date format 2013-8-7. So how can we make it easier for users to receive data! Next I will introduce a function.

The Replace () function, which means "substitution", can solve the problem encountered above.

Returns a string in which the specified substring has been replaced with another substring and the number of times it has been replaced is also specified.

Syntax

Replace (Expression,Find,Replacewith[,Start[,Count[,Compare])

ReplaceFunction syntax includes the following parts:

Part Description
Expression Required. String expression that contains the substring to be replaced.
Find Required. The substring to be searched.
Replacewith Required. The substring to replace.
Start Optional. Start position of the substring search in the expression. If this parameter is ignored, start from 1.
Count Optional. The number of times the substring is replaced. If ignored, the default value is-1, which indicates all possible replacements.
Compare Optional. Numeric value, indicating the comparison method used to determine the substring. For more information about the value, see "set value.

 

Suppose we write in the code to confirm to add information to write

Text1.text = Replace (text1, ".", "-") 'in the text box 1, it is a searched character.-It is a replacement character.

Enter 2013.8.7 in the text1 text box and click OK.

The character received by the database is 2013-08-07. The slash/is also replaced.

 

 

 

 

 

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.