Now() function with time trim

前端 未结 6 1037
忘了有多久
忘了有多久 2020-12-16 10:23

So the function =Now()....is there a way I can use this and only get the date, not the time?

or is there just a function for this idea?

6条回答
  •  感动是毒
    2020-12-16 11:14

    Paste this function in your Module and use it as like formula

    Public Function format_date(t As String)
        format_date = Format(t, "YYYY-MM-DD")
    End Function
    

    for example in Cell A1 apply this formula

    =format_date(now())
    

    it will return in YYYY-MM-DD format. Change any format (year month date) as your wish.

提交回复
热议问题