Yes I see your restriction against using Date::Manip
, and I'm not going to bother asking what that's all about, but in the event someone else comes upon your question (which is the purpose for posting it into Q&A, right?), they may not have such restrictions placed on their development. In such a case, the following code might be useful:
$diff = &DateCalc("now", "21st at midnight");
$seconds = &Delta_Format($diff, 0, "%st");
You can certainly use other modules such as Date::Calc
, but it will require additional logic.