Some friends encountered the problem of converting Gregorian calendar dates to lunar calendar dates when using Excel. PHP editor Banana will introduce how to solve this problem. The following content will introduce the operation method in detail to help you easily convert the Gregorian calendar to the lunar calendar.
Take the following table as an example. The left side is the Gregorian calendar and the right side is the lunar calendar. Fill in the function formula in the lunar calendar cell. =TEXT(A2,"[$-130000]yyyy-m-d")
where A2 represents the Gregorian calendar cell to be converted, yyyy-m-d represents the format of the converted date, and [$ -130000] is the key to the lunar calendar conversion. Finally press Enter and fill it in.
If you think the format of this lunar calendar is not good-looking and does not have the characteristics of traditional Chinese display, then the formula can be changed: =TEXT(A2,"[$-130000]yyyyyear m Month"&IF(LEN(--TEXT(A2,"[$-130000]dd"))=1,"Initial","")&"d"). Then press Enter to fill in the same way. In this way, the day of the month can be displayed.
The above is the detailed content of How to convert Gregorian calendar date to lunar calendar in Excel. For more information, please follow other related articles on the PHP Chinese website!