Looker Studio is now called Data Studio. Learn more about this change.

PARSE_DATE

Converts text to a date.

Sample usage

PARSE_DATE("%x", DateText)

Syntax

PARSE_DATE( format_string, text )

Parameters

format_string - A string representation of the format of your date field. See Format elements for date and time parts for a list of format elements that this function supports.

text - a text representation of a date.

Return data type

Date

Example

In these examples, DateText is a field containing a text date. Use the format_string field to specify the format of that text string. Applying PARSE_DATE to the text field returns a Date value.

Example formula Input Output
PARSE_DATE("%m/%d/%y", DateText) 12/25/08 2008年12月25日
PARSE_DATE("%d%m%Y", DateText) 25122008 2008年12月25日

Notes

When using PARSE_DATE, keep the following in mind:

  • Unspecified fields. Any unspecified field is initialized from 1970年01月01日.
  • Case insensitive names. Names, such as Monday, February, and so on, are case insensitive.
  • Whitespace. One or more consecutive white spaces in the format string matches zero or more consecutive white spaces in the date string. In addition, leading and trailing white spaces in the date string are always allowed -- even if they are not in the format string.
  • Format precedence. When two (or more) format elements have overlapping information (for example both %F and %Y affect the year), the last one generally overrides any earlier ones.

This function supports format elements, but does not have full support for %Q, %a, %A, %g, %G, %j, %u, %U, %V, %w, and %W.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026年08月26日 UTC.