Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Questa pagina spiega come eseguire trasformazioni delle date durante la preparazione dei dati nello spazio di lavoro Wrangler di Studio di Cloud Data Fusion.
L'area di lavoro di Wrangler supporta le trasformazioni delle date descritte nelle
sezioni seguenti.
Analizza le date
Per analizzare i valori delle colonne da una stringa a un tipo di dati data:
Nella scheda Dati, vai a un nome di colonna e fai clic sulla freccia di espansione arrow_drop_down.
Seleziona Analizza > Data semplice.
Specifica il seguente formato personalizzato: MM/dd/yy HH:mm. Il formato deve corrispondere alla formattazione della data nella colonna. Se selezioni un formato data che non corrisponde alle date nella colonna, otterrai risultati errati.
Il tipo di dati della colonna passa da stringa a
Timestamp_micros.
Recuperare i componenti
Gli esempi seguenti mostrano le direttive che recuperano i componenti della data, ad esempio mese, giorno, anno, minuto, secondo o ora:
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-08-12 UTC."],[[["\u003cp\u003eThis page details how to perform date transformations within the Wrangler workspace of Cloud Data Fusion Studio.\u003c/p\u003e\n"],["\u003cp\u003eYou can parse date values from strings into a date data type by specifying a custom format that matches the column's formatting in the Wrangler workspace.\u003c/p\u003e\n"],["\u003cp\u003eThe Wrangler workspace allows for extracting specific date components like month, year, day of the week, hour, and second, from date data types.\u003c/p\u003e\n"],["\u003cp\u003eYou can add or subtract time units, such as days, hours, minutes, months, weeks, years, seconds, or nanoseconds, to date values using specific directives.\u003c/p\u003e\n"]]],[],null,["# Transform dates\n\nThis page explains how to perform date transformations when you prepare data in\nthe Wrangler workspace of the Cloud Data Fusion Studio.\n\nThe Wrangler workspace supports the date transformations described in the\nfollowing sections.\n\nParse dates\n-----------\n\nTo parse column values from a string to a date data type, follow these steps:\n\n1. [Go to Wrangler workspace in Cloud Data Fusion](/data-fusion/docs/concepts/wrangler-overview#navigate-to-wrangler).\n2. On the **Data** tab, go to a column name and click the arrow_drop_down expander arrow.\n3. Select **Parse \\\u003e Simple date**.\n4. Specify the following custom format: `MM/dd/yy HH:mm`. The format must\n match the date formatting in the column. If you select a date format that\n doesn't match the dates in the column, you will get incorrect results.\n\n The data type of the column changes from string to\n `Timestamp_micros`.\n\nGet components\n--------------\n\nThe following examples show directives retrieving date components, such as the\nmonth, day, year, minute, second, or hour: \n\n set-column :month Transaction_date.getMonth()\n\n set-column :year Transaction_date.getYear()\n\n set-column :day_of_week Transaction_date.getDayOfWeek()\n\n set-column :day_of_month Transaction_date.getDayOfMonth()\n\n set-column :day_of_year Transaction_date.getDayOfYear()\n\n set-column :minute Transaction_date.getMinute()\n\n set-column :hour Transaction_date.getHour()\n\n set-column :second Transaction_date.getSecond()\n\n set-column :zone Transaction_date.getZone()\n\nAdd time\n--------\n\nThe following examples show directives that add units of time to the date: \n\n set-column :add_days Transaction_date.plusDays(1)\n\n set-column :add_hours Transaction_date.plusHours(200)\n\n set-column :add_minutes Transaction_date.plusMinutes(3600)\n\n set-column :add_months Transaction_date.plusMonths(3)\n\n set-column :add_weeks Transaction_date.plusWeeks(2)\n\n set-column :add_years Transaction_date.plusYears(2)\n\n set-column :add_seconds Transaction_date.plusSeconds(36000)\n\n set-column :add_nonoseconds Transaction_date.plusNanos(3600000)\n\nSubtract time\n-------------\n\nThe following examples show directives that subtract units of time from the\ndate: \n\n set-column :subtract_days Transaction_date.minusDays(1)\n\n set-column :subtract_hours Transaction_date.minusHours(200)\n\n set-column :subtract_minutes Transaction_date.minusMinutes(3600)\n\n set-column :subtract_months Transaction_date.minusMonths(3)\n\n set-column :subtract_weeks Transaction_date.minusWeeks(2)\n\n set-column :subtract_years Transaction_date.minusYears(2)\n\n set-column :subtract_seconds Transaction_date.minusSeconds(36000)\n\n set-column :subtract_nonoseconds Transaction_date.minusNanos(3600000)\n\nWhat's next\n-----------\n\n- Learn more about [Wrangler directives](/data-fusion/docs/concepts/wrangler-overview#apply_directives)."]]