Cov txheej txheem:

Kuv yuav hloov hnub tim rau Yyyymdd li cas?
Kuv yuav hloov hnub tim rau Yyyymdd li cas?

Video: Kuv yuav hloov hnub tim rau Yyyymdd li cas?

Video: Kuv yuav hloov hnub tim rau Yyyymdd li cas?
Video: Kablia vwj& koj tsis yuav kuv nkauj tshiab 2019_2020 2024, Kaum ib hlis
Anonim

Nrog rau cov txheej txheem no, koj yuav tsum rho tawm txhua feem ntawm ib qho hnub nrog cov ntawv ua haujlwm.

Yog li yog tias koj muaj YYYYYMMDD hom hloov pauv, ntawm no yog cov kauj ruam ua raws.

  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.
  4. Kauj Ruam 4: Hloov txhua qhov chaw raws li a hnub .

Hais txog qhov no, kuv yuav hloov hnub rau Yyyymdd hauv Excel li cas?

Hauv Excel , yog tias koj xav tau hloov hnub mus ntawv nrog yyyy-mm-dd hom ntawv, koj tuaj yeem siv cov qauv. 1. Xaiv ib lub xov tooj dawb ntawm ib sab ntawm koj hnub , piv txwv li. I1, thiab ntaus cov qauv no = TEXT(G1, " yyyy-mm-dd "), thiab nias Enter tus yuam sij, tom qab ntawd luag AutoFill tuav lub hlwb xav tau cov qauv no.

Ib sab saum toj no, YYYY MM DD hom ntawv yog dab tsi? Kev thoob ntiaj teb hom ntawv txhais los ntawm ISO (ISO 8601) sim daws tag nrho cov teeb meem no los ntawm kev txheeb xyuas cov lej hnub raws li hauv qab no: YYYY - MM - DD qhov twg. YYYY yog xyoo [tag nrho cov lej, piv txwv li 2012] MM yog lub hli [01 (Lub Ib Hlis) txog 12 (Lub Kaum Ob Hlis)]

Tom qab ntawd, ib tus tuaj yeem nug, Kuv yuav hloov hnub hom ntawv li cas hauv Yyyymdd hauv SQL?

Yuav ua li cas kom tau txais ntau hom SQL Server hnub tim

  1. Siv cov kev xaiv hnub hom nrog rau CONVERT muaj nuj nqi.
  2. Kom tau txais YYYY-MM-DD siv SELECT CONVERT(varchar, getdate(), 23)
  3. Kom tau MM/DD/YYYY siv SELECT CONVERT(varchar, getdate(), 1)
  4. Tshawb xyuas daim ntawv qhia kom tau txais cov npe ntawm txhua hom kev xaiv.

Kuv yuav hloov hnub los ntawm Yyyymdd rau Ddmmyyyy li cas?

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.

Pom zoo: