Cov txheej txheem:

Yuav tau txais hnub tim li cas hauv dd mm yyyy hom hauv PHP?
Yuav tau txais hnub tim li cas hauv dd mm yyyy hom hauv PHP?

Video: Yuav tau txais hnub tim li cas hauv dd mm yyyy hom hauv PHP?

Video: Yuav tau txais hnub tim li cas hauv dd mm yyyy hom hauv PHP?
Video: CCI Application 2024, Hlis ntuj nqeg
Anonim

Teb: Siv strtotime() Muaj nuj nqi

Koj ua tau thawj siv cov PHP strtotime() muaj nuj nqi rau hloov tej ntawv nyeem hnub tim rau hauv Unix timestamp, ces tsuas yog siv lub PHP hnub () ua haujlwm rau hloov lub sij hawm no rau hauv qhov xav tau hnub format . Cov piv txwv nram qab no yuav convert ib hnub los ntawm yog yyyy - mm - dd format rau dd - mm - yog yyyy.

Ib yam li ntawd, kuv yuav ua li cas hloov hnub tim hom ntawv los ntawm Yyyymdd rau dd mm yyyy?

Hloov nrog cov qauv

  1. Kauj Ruam 1: Tshem tawm lub xyoo. =LEFT(A1, 4) => 2018.
  2. Kauj Ruam 2: Tshem tawm lub hnub. =RIGHT(A1, 2) => 25.
  3. Kauj Ruam 3: Tshem tawm lub hli. Cov kauj ruam no yog qhov nyuaj me ntsis vim tias koj yuav tsum rho tawm 2 tus cim hauv nruab nrab ntawm koj txoj hlua.
  4. Kauj Ruam 4: Hloov txhua ntu ua hnub tim.

Ib yam li ntawd, PHP hnub ua haujlwm yog dab tsi? PHP hnub ua haujlwm yog nyob rau hauv-built muaj nuj nqi uas yooj yim ua hauj lwm nrog hnub hom ntaub ntawv. Cov PHP hnub ua haujlwm yog siv los format a hnub los yog lub sij hawm mus rau hauv tib neeg readable hom ntawv. Nws tuaj yeem siv los tso saib cov hnub ntawm tsab xov xwm tau luam tawm. sau cov ntaub ntawv kho tshiab kawg hauv ib lub database.

Ib yam li ib tug yuav nug, hnub twg yog hnub twg yyyy mm dd?

(Lub format dd . mm .( ua yy ) ua yy yog ib txwm Danish hnub format . Kev thoob ntiaj teb format yus - mm - dd los yog yymmd ua kuj lees txais, txawm tias qhov no hom ntawv tsis yog siv ntau. Cov hom ntawv d. 'lub hli lub npe' yog yyyy thiab sau ntawv d/m- ua yy los yog d/m yog yyyy kuj txais tau.)

Kuv yuav hloov hnub tim hom ntawv li cas los ntawm YYYY MM DD rau CSV?

Kev daws teeb meem

  1. Qhib koj cov ntaub ntawv hauv Microsoft Excel.
  2. Right-click lub kem uas muaj hnub.
  3. Xaiv "Format cells"
  4. Nyem "Hnub" nyob rau hauv Number >> Qeb.
  5. Xyuas kom qhov chaw (Language) yog teem rau United Kingdom (English)
  6. Xaiv formatting uas qhia hnub tim hauv dd/mm/yyyy format.

Pom zoo: