Best practice forum (Archived)

Custom Date/time field displaying incorrect date

 
Stephen Cope
Custom Date/time field displaying incorrect date
על ידי Stephen Cope בתאריך 1/03/2016, 02:40
 

I’ve created an additional profile field to add a date; however when I do a CSV file upload the date field is not updating to the correct date.  It was showing the 1st Jan 1970.  I have updated the year start date and now it’s just displaying the 1st of Jan 2016. 

I have added the correct column title ‘profile_field_RNLED’ and my other custom fields are working correctly. The CSV file uploads without any errors.

 

There is a similar bug in moodle  https://tracker.moodle.org/browse/MDL-38494 that seems to have been resolved.

 

Any help would be very welcome.

Thanks

Stephen

Lenka Kolesarova
Re: Custom Date/time field displaying incorrect date
על ידי Lenka Kolesarova בתאריך 1/03/2016, 05:03
קבוצה Partnersקבוצה TXP Site Administrator

Hi Stephen,

the format for the date/time field which is working for uploading users via CSV in Site administration > Users > Accounts > Upload users is YYYY-MM-DD, as suggested in the Moodle tracker issue https://tracker.moodle.org/browse/MDL-38494

Totara documentation concerning this is wrong, at the very bottom of this page https://help.totaralms.com/User_Profile_Fields.htm it says:

"Uploading Date Field
When uploading a custom field which is a Date/Time field, be sure not to include an apostrophe (') or dashes (-). For example, 2004-12-01 should be entered in the .csv upload file as 2004 12 01."

But the suggested format  YYYY MM DD for the date/time field does NOT work, it results in the date always showing as 1st Jan 1970.

Cheers,
Lenka

me
Re: Custom Date/time field displaying incorrect date
על ידי George Angus בתאריך 1/03/2016, 17:42
קבוצה Totara

Hi folks,

First of all the link is to the old helpsite, and I agree that the advice there is wrong.  There is something here in the new Helpsite, but it doesn't mention the format of the custom date field, however I didnt have any problems provided entered the date in the same format I defined for the column. Can I ask what version you are using and what date format is being used too?

cheers,

George.

Stephen Cope
Re: Custom Date/time field displaying incorrect date
על ידי Stephen Cope בתאריך 2/03/2016, 00:50
 

Hi George,

I am using version 2.9, if I use the formatting,  YYYY-MM-DD  then it works fine.  I was following the formatting information on the old site that says not to include an apostrophe (') or dashes (-).

Thanks

Stephen

Lenka Kolesarova
Re: Custom Date/time field displaying incorrect date
על ידי Lenka Kolesarova בתאריך 2/03/2016, 02:37
קבוצה Partnersקבוצה TXP Site Administrator

Hi Goerge,

I have tested this both in Totara 2.9 and 2.7 (which the documentation https://help.totaralms.com/User_Profile_Fields.htm is for), with the same problem. The format with dashes works, but without dashes does not.

Cheers,

Lenka

Ryan O'Malley
Re: Custom Date/time field displaying incorrect date
על ידי Ryan O'Malley בתאריך 2/03/2016, 06:05
 

Hi all,

Have you tried setting the date format under Site administration > Location > Location settings > CSV Import date format ?

By default it expects date fields to be in the format d/m/Y (i.e. 21/03/2012)

Cheers,

Ryan