From 603f8799cf431aa407a8628cac3b79370070ecd7 Mon Sep 17 00:00:00 2001 From: Hashir Omer Date: Fri, 6 Jan 2023 10:39:23 +0000 Subject: [PATCH] Updated filename to include current date --- upwork/upworkPipeline.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/upwork/upworkPipeline.go b/upwork/upworkPipeline.go index d662e3a..f27ef7c 100644 --- a/upwork/upworkPipeline.go +++ b/upwork/upworkPipeline.go @@ -6,6 +6,7 @@ import ( "fmt" "log" "os" + "time" ) type UpworkPipeLine struct { @@ -45,8 +46,15 @@ func (u *UpworkPipeLine) CombineFiles() error { all_jobs = append(all_jobs, job.(map[string]interface{})) } + now := time.Now() + + // Format the date and time using the "2006-01-02" layout + dateString := now.Format("2006-01-02") + + // Create the file name using the date string + filename := "file_" + dateString + ".json" + //save to file - filename := "all_jobs.json" //Convert to json json_data, err := json.Marshal(all_jobs)