vendredi 27 février 2015

VB Script date formats "YYYYMMDDHHMMSS"

As title surgest I need to fomat the now () function to display on the format "YYYYMMDDHHMMSS"


I did have a play about trying to split it out but this drops leading zeros that I need to retain


example below mydt was "27/02/2015 13:02:27"



mydt = now()

MSGBOX Year(mydt)& Month(mydt)& Day(mydt)& Hour(mydt)& Minute(mydt)& second(mydt)


this returns "201522713227"


i need it to return "20150227130227" i could use a if < 10 but there must be a slicker way


Aucun commentaire:

Enregistrer un commentaire