{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"redocly_category":"Products","product_name":"Data Workbench","type":"markdown"},"seo":{"title":"Calculating Variables","description":"Treasure Data Product Documentation · Collect and Unify · Segment and Activate · Experiment and Analyze · Decisioning Automate with AI Scale and Trust.","siteUrl":"https://docs.treasuredata.com","lang":"en-US","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"calculating-variables","__idx":0},"children":["Calculating Variables"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use basic JavaScript scripts in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["${...}"]}," syntax to calculate variables."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For example, to format a timestamp in different ways. Digdag bundles ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"http://momentjs.com/"},"children":["Moment.js"]}," for time calculation."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"yaml","header":{"controls":{"copy":{}}},"source":"timezone: America/Los_Angeles\n\n+format_session_time:\n  echo>: '${moment(session_time).format(\"YYYY-MM-DD HH:mm:ss Z\")}'\n+format_in_utc:\n  echo>: '${moment(session_time).utc().format(\"YYYY-MM-DD HH:mm:ss\")}'\n+format_tomorrow:\n  echo>: '${moment(session_time).add(1, ''days'').format(\"LLL\")}'\n+get_execution_time:\n  echo>: '${moment().format(\"YYYY-MM-DD HH:mm:ss Z\")}'\n","lang":"yaml"},"children":[]}]},"headings":[{"value":"Calculating Variables","id":"calculating-variables","depth":1}],"frontmatter":{"seo":{"title":"Calculating Variables"}},"lastModified":"2025-11-22T02:43:27.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/products/customer-data-platform/data-workbench/workflows/calculating-variables","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}