Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Loading month/year timestamp (01/2012, 02/2012..)

Hi,

I'm trying to load month/year format as datetime, so '01/2012' would become 01/01/2012 datetime.

However I don't quite understand why the following doesn't work

Test:

LOAD

  Amount,

  Date(MonthYear, 'MM/YYYY') as MyDate

INLINE [Amount, MonthYear

          1, 01/2012

          3, 01/2012

          4, 01/2012

          5, 01/2012

          6, 01/2012

          7, 01/2012];

I also trie the following

Date('01/' & MonthYear, 'DD/MM/YYYY') as MyDate

But that didn't work either.

What could be wrong with my load script?

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Use

Date(Date#(MonthYear, 'MM/YYYY')) as MyDate

Or, if you want to be more explicit:

MonthStart(Date#(MonthYear, 'MM/YYYY')) as MyDate

The Date() function formats the display format of a date. The Date#() function interprets a string value as a date.


Hope that helps

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

1 Reply
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Use

Date(Date#(MonthYear, 'MM/YYYY')) as MyDate

Or, if you want to be more explicit:

MonthStart(Date#(MonthYear, 'MM/YYYY')) as MyDate

The Date() function formats the display format of a date. The Date#() function interprets a string value as a date.


Hope that helps

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein