Pergunta

I am trying to find a way to get the current date in to the CYYMMDD format so that I can do an SQL call to our AS400. Does anyone have an easy way of doing this in PHP or will I have to create an RPG program to do it?

Century - Year - Month - Date

Example:

1/27/2014 would convert to 1140127 and 1/26/2014 would convert to 1140126

Thanks!

Foi útil?

Solução

$str = (date('Y') >= 2000? 1 : 0) . date('ymd');
echo $str;

Outras dicas

Convert a full YYYYMMDD format into CYYMMDD format by subtracting 19000000:

For example:

<?php echo date('Ymd') - 19000000 ?>
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top