You need to sign in to do that
Don't have an account?
bca321
Apex code error
Hi,
My date field type is Date. date patern is yy-mm-dd.
String year = '';
String month = '';String day =
'';string stringDate = year + '' + month + '' + day;Date DueDate = date.valueOf(stringDate);
my code is here. but still error. can you pl's tel me how to write code. and also I want to write regular expression for that date field.
Hi,
Here the code sample,
String year = '';
String month = '';
String day = '';
String StringDate = year + '' + month + '' + day;
Date DueDate = date.valueOf(stringDate);
Perhaps you could benefit from a bit more time studying the manual and experimenting with execute anonymous. The docs for the method valueOf for the class date say it works like this:
The String should use the standard date format "yyyy-MM-dd HH:mm:ss" in the local time zone. For example:
string year = '2008';
string month = '10';
string day = '5';
string hour = '12';
string minute = '20';
string second = '20';
string stringDate = year + '-' + month
+ '-' + day + ' ' + hour + ':' +
minute + ':' + second;
Date myDate = date.valueOf(stringDate);
for decimal type what is the regular expresion
ex; Desimal amount;
45678.00
for Double type what is regular expression
ex: double number
234