0

I have a String stored as a Label in this format : 2014, 8, 01, 0, 0, 0. This is eventually meant to return a UNIX_TIME_STAMP. So I tried the following :

private static final String myDate = System.Label.My_Date;
Long dt = Datetime.valueOf(myDate).getTime();
System.debug('The specified date = ' + dt);

But I get error 'Invalid Date/Time'. How can I solve this error?

1

1 Answer 1

0

I solved the issue :

Datetime dt = DateTime.parse(System.Label.My_Date);
Long x = (Long)Datetime.valueOf(dt).getTime();
System.debug('The specified date = ' + x);

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .