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

Date, Year, Month

Hi Guys,

I have a field that appears like this

DateTime.png

If i want another list bos with just the date, year or month what do I need to write in the load script. I've tried, Date(), Date#() and Date(Date#() to get date, and none work. Maybe I am using one of the above QV functions incorrectly, I dont know

Thanks,

Byron

1 Solution

Accepted Solutions
Not applicable
Author

The two pieces of code Im using as a final reply to this thread

Date(DayStart(DateTime)) as Date

Time(DateTime-Date(DayStart(DateTime)),'hh:mm:ss') as IntervalTime

View solution in original post

9 Replies
Not applicable
Author

I seem to have gotten it right with this

Date(Round(DateTime,1),'YYYY/MM/DD'). If there is another way please let me know. Not sure if this method restricts my reporting in any kind of way

Not applicable
Author

Ok, but now another problem. I need just the time

Not applicable
Author

Ok got this too, but my method looks ugly

Time(DateTime-Date(Round(DateTime,1)),'hh:mm:ss') as IntervalTime

Any other suggestions????

Not applicable
Author

Hi,

Try this:

LOAD DateTime,

          DATE(DAYSTART(DateTime), 'DD/MM/YYYY') AS Only_Date,

          DATE(DateTime, 'hh:mm:ss') AS Only_Time;

...

Not applicable
Author

Thanks Ecorrea,

Only_Date worked but not the Only_Time. Only_Time shows me time in that format, but I would see the same time appear more than once. This is probably due to the fact that the timestamp it is linked to is picking up different dates with that time

Not applicable
Author

Byron, Try With this.

Date(Timestamp#(DateTime,'DD/MM/YYYY hh:mm:ss tt')) as Date,

Month(Timestamp#(DateTime,'DD/MM/YYYY hh:mm:ss tt')) as Month,

Time(Timestamp#(DateTime,'DD/MM/YYYY hh:mm:ss tt')) as Time

hope this helps you.

- Sridhar

Not applicable
Author

You may try this:

date( MakeDate(left(Date,4), mid(Date,5,2 ),right(Date,2 )),'YYYY/MM/DD') as [Start Period]

You can take or split what you need.I hope it helps!!

Not applicable
Author

Hi Scridhar,

No luck with any of those

----------------------------------------------------------------

Hi Javortiz

I can use that but all that a timestamp is, is a number with decimals. So to get date, all I need to do is remove decimals. Therefore I could use your code, but I dont really need to recreate the date, just round it down to the nearest integer.

------------------------------------------------------------------

I am currently using Eccorea's code for the date as the 'round' has issues unless I can tell it to round down.

Thanks to all for your replies and insight. Much appreciated

Cheers,

Byron

Not applicable
Author

The two pieces of code Im using as a final reply to this thread

Date(DayStart(DateTime)) as Date

Time(DateTime-Date(DayStart(DateTime)),'hh:mm:ss') as IntervalTime